Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

A quick help?, Cause i need one.

Well... im sorry for making this, because its almost a "pls maek mi gem" kind of question.

So, i wanna make a morph, but i already have it done.

The thing is, i also made custom animations, and i have this script:

game.Players.PlayerAdded:connect(function(player)
	while not player.Character do wait() end
	local character = player.Character
	local animateScript = character.Animate
	animateScript.idle.Animation1.AnimationId = 'http://www.roblox.com/asset/?id=1527085282'
end)
--It loads the animation i want, loading it to every added player

But, i want that when you press the morph plate to morph into it, your idle animation change to the one stated there.

Is there any way i can make it so when pressing that part it gives me the animation?

1 answer

You can derive the content of the script into a function which activates when the morph plate is touched (i realize you got this from the wiki which is a good start :P)

Your script changes the animation whenever the player joins the game; notice how the function is connected to PlayerAdded. To make the script work when you touch a morph, we'll just use the same content but make it work inside of a Touched function.

Make sure this script is inside of the morph plate.

function ontouch(h)
if h.Parent:FindFirstChild("Humanoid") then --make sure this is a character
local character = h.Parent --we know this is a character so set the variable as a character
	local animateScript = character.Animate -- variable for the Animate script inside of the character
	animateScript.idle.Animation1.AnimationId = 'http://www.roblox.com/asset/?id=1527085282' --change the animation
end
end
script.Parent.Touched:connect(ontouch) -- make this function activate when part is touched

3 comments

0

Hey, Thanks dude!,This will help me alot!

0

Just a little question.. This works on filtering enabled?

0

No, this isn't a FE script.

This discussion is preserved as it was. New answers, comments, and votes are closed.