When your SurfaceGui isn’t showing up on its adornee #RobloxDev

So this might be a problem only I have because I am a weirdo but … just in case.
I was running a script where I:

  1. Cloned a model
  2. Passed the cloned model through to a function to do some stuff to it, including:
  3. Cloned a SurfaceGui
  4. Assigned the SurfaceGui parent to the PlayerGui
  5. Set the SurfaceGui Adornee to one of the pieces in my cloned model
  6. Parented the model in the workspace

The problem was, my GUI was not showing on the model. The cloned gui was in my player.PlayerGui, and the Adornee was assigned, but it was invisible.
I checked if it was enabled, I checked if all the elements were visible .. nothing.
And then I realized that the model’s parent was set AFTER the adornee was being assigned to the part in the model.
When I gave the model a parent in the workspace and THEN assigned the Adornee, all was well. I am left to assume I shouldn’t be assigning adornees in models outside the workspace.

So: if you’re assigning a SurfaceGui adornee to a model without a parent, try parenting the model first.

Scaling R15 Models with NumberValue objects – script vs. manual

So I’m pretty good at scripting and pretty lousy at working with models. I tried to get around dealing with sizing my monster characters by doing it through script instead of manipulating the models. Spoiler alert: BIG MISTAKE.

Basically I did this with script:

  1. Created a bunch of monster spawner locations
  2. Picked an enemy from an enemy type list I’d set up
  3. Cloned the chosen enemy model into the workspace
  4. Moved it to the position of the spawner

This was fine for my standard sized zombie model.

It was NOT fine for my giant zombie model.  I first tried to scale it using code by

  1. Cloning the regular sized Zombie model via script
  2. Using script to create scale NumberValue Objects in the monster’s Humanoid (see wiki) and setting them:
    1. BodyDepthScale = 5
    2. BodyHeightScale = 5
    3. BodyWidthScale = 5
    4. HeadScale = 5
  3. Then cloned them off.

Here’s what happened:

Head in torso!

Legs merged!

The Solution (so far)

Well.. I haven’t found a way to do this through script. However, I did have success doing it manually:

  1. In Studio (not script), I copied the Zombie model
  2. I created the four variables above in the Giant Zombie humanoid:
  3. When I did that, the pieces of the zombie got all out of alignment, which gives some clues as to why when you do it with script you get a jumbled mess. So, I manually put the Zombie back together again, lining up the head, torso, arms etc.

Better!

I’d love to be able to do this with scripting, and can probably write something to place the parts back where they belong, but for now this will allow me to have giants roaming around without me going absolutely bonkers.

 

When a part keeps falling off a model you’re trying to animate

So I’ve been working with NPCs to try and introduce some enemies to the new Battle Farm. I started with some existing models since I am brand new to moving NPCs around and wanted to see some scripting examples. I downloaded this one which does almost exactly what I wanted it to do (I will modify but it’s a great start for what I need).

The only problem was: when I started the game the Zombie’s head would fall off! I knew I couldn’t anchor it or the Zombie would be stuck.

Turns out what I needed was MakeJoints(). In this case all I needed to do was add it to the zombie load script like so:

script.Parent:MakeJoints()

Done and done!