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

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

Asked by
Shematics 117
5 years ago

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)

0
Put your code in a codeblock so we can see it easier seith14 206 — 5y
0
Don't come on this site with alvinbloxx's script, expecting for it to be fixed. User#19524 175 — 5y

Closed as Not Constructive by User#19524

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 5 years ago

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).

Ad