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:
- Cloned a model
- Passed the cloned model through to a function to do some stuff to it, including:
- Cloned a SurfaceGui
- Assigned the SurfaceGui parent to the PlayerGui
- Set the SurfaceGui Adornee to one of the pieces in my cloned model
- 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.
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:
- Created a bunch of monster spawner locations
- Picked an enemy from an enemy type list I’d set up
- Cloned the chosen enemy model into the workspace
- 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
- Cloning the regular sized Zombie model via script
- Using script to create scale NumberValue Objects in the monster’s Humanoid (see wiki) and setting them:
- BodyDepthScale = 5
- BodyHeightScale = 5
- BodyWidthScale = 5
- HeadScale = 5
- Then cloned them off.
Here’s what happened:
Head in torso!
The Solution (so far)
Well.. I haven’t found a way to do this through script. However, I did have success doing it manually:
- In Studio (not script), I copied the Zombie model
- I created the four variables above in the Giant Zombie humanoid:
- 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.
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.
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:
Done and done!