Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

A quick help?, Cause i need one.

Asked by 6 years ago

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

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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
0
Hey, Thanks dude!,This will help me alot! Chris75764 49 — 6y
0
Just a little question.. This works on filtering enabled? Chris75764 49 — 6y
0
No, this isn't a FE script. ultrasonicboomer 85 — 6y
Ad

Answer this question