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

How do I make a thing that if you touched, the Value will change?

Asked by 4 years ago

Please answer this. I have no idea to do this.

1 answer

Log in to vote
0
Answered by
Xapelize 2658 Moderation Voter Community Moderator
4 years ago

Bruh, please, I think you can try it yourself. You're warned.

Uh, anyway, this is the script though.

Before this, make a NumberValue in the game, and parent the Value to a part, and insert a script into the part that you inserted that NumberValue.

debounce = false -- we use debounce to prevents spams

while wait(.5) do -- update the script every 0.5 seconds
script.Parent.Touched:Connect(function(plr) -- if people touched
    debounce = true
    script.Parent.Value.Value = 1 -- make the value become 1
    debounce = false
end)

script.Parent.TouchEnded:Connect(function(plr) -- if people touch ended then
    debounce = true
    script.Parent.Value.Value = 0 -- make the value become 0.
    debounce = false
end)
end

Anyways, here's the script, so if you have more questions, PM me, or question below! I'll be glad to help. But please don't ask for the script again, try it yourself first, thanks!

0
Thanks xD Xapelize 2658 — 4y
Ad

Answer this question