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

How can i add a disable/enable function to a script?

Okay guys I have this little trail script, what I want is when the player jump, the trails the trails enable the time of the jump and land of the player, and then it disable and ect..

Here is the scripts:

game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(char) local trail = game.ServerStorage.Trail:Clone() trail.Parent = char.Head local attachment0 = Instance.new("Attachment",char.Head) attachment0.Name = "TrailAttachment0" local attachment1 = Instance.new("Attachment",char.HumanoidRootPart) attachment1.Name = "TrailAttachment1" trail.Attachment0 = attachment0 trail.Attachment1 = attachment1 end) end)

2 comments

0

Put your code in a codeblock so we can see it easier

0

Don't come on this site with alvinbloxx's script, expecting for it to be fixed.

1 answer

✓ Accepted answer

Humanoid has a property called jump, whenever it is true you can make the trail visible and when it's false you make it invisible (you can check through an infinite loop). If the trail does not have some sort of visible or enabled feature then just destroy it and recreate it (this permanent loop and destroying and recreating may cause lag in bigger games so try to see if there is an enabled/visible feature and an alternative option to the loop).

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