I tried making a part that gives the players a jumpboost when they stepped on it. I stored it in the ReplicatedStorage so I can clone the jumpboost part and put it in the workspace. First the part will spawn in the workspace, and then it will give the player that touched the part a jumpboost, and then the part would proceed by destroying itself when it has been touched by the player and respawn again in the workspace. Unfortunately, it didn't work. The part didn't seem to spawn in. Here's the script:
local jumpBoost = game.ReplicatedStorage:FindFirstChild("JumpBoost")
local clonedJumpBoost = jumpBoost:Clone()
clonedJumpBoost.Parent = workspace
local boostPart = game.ReplicatedStorage.JumpBoost
local boostedJumpPower = 100
local function onPartTouch(otherPart)
local partParent = otherPart.Parent
local humanoid = partParent:FindFirstChildWhichIsA("Humanoid")
if ( humanoid ) then
boostPart.CanCollide = false
local currentJumpPower = humanoid.JumpPower
if currentJumpPower < boostedJumpPower then
humanoid.JumpPower = boostedJumpPower
boostPart:Destroy()
wait(10)
humanoid.JumpPower = currentJumpPower
end
end
end
boostPart.Touched:Connect(onPartTouch)
clonedJumpBoost.Parent = game.Workspace

2 comments
Which one should I change?
Nvm I figured it out. Thanks!