Here is the script:
script.Parent.Touched:Connect(function()
game.Players.LocalPlayer["Right Leg"].Parent = nil
end)
Any small info will help!
Here is the script:
script.Parent.Touched:Connect(function()
game.Players.LocalPlayer["Right Leg"].Parent = nil
end)
Any small info will help!
Welp, game.Players.LocalPlayer is not the player's Character in workspace, it is the player him or herself. So I suggest you use a ServerScript instead of a LocalScript.
Script will look like this:
local Touched = false -- A "debounce"
script.Parent.Touched:Connect(function(Hit)
if Touched == false then
if Hit.Parent:FindFirstChild("Right Leg") then -- Add this so it doesn't throw an error if Right Leg doesn't exist
Hit.Parent:WaitForChild("Right Leg"):Destroy()
-- Using :Destroy() may give an error so you may want to do it this way(Remove the "--" if :Destroy() gives an error):
-- local Debris = game:GetService("Debris")
-- Debris:AddItem(Hit.Parent["Right Leg"])
wait(0.5)
if Hit.Parent then -- Check if the player is still touching the part and if the player is, their other limb will be destroyed
if Hit.Parent:FindFirstChild("Left Leg") then
print("Player Is Still Touching The Part :/")
Hit.Parent:WaitForChild("Left Leg"):Destroy() -- Feel free to change "Left Leg" to other parts of the player's character
end
end
Touched = false
end
end
end)
Thanks! Could i do it so every 0.5 second they are on there they lose another limb? Would i have to add debounce?
I added a few lines which you can try, I'm not sure if it will work tho but you can try and see if it works
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
you cannot use local player in a script
Instead of using
.Parentyou use: Destroy ()