Why won't it work?
if Part.Touched == true then
score.Value = FirstValue + 1
end
Why won't it work?
if Part.Touched == true then
score.Value = FirstValue + 1
end
Good attempt, but there's a lot more than that for your script. You would put this script into your parts so you can give them a score.
Place inside your parts:
local Pressed = false --We need to provide a local variable.
script.Parent.Touched:connect(function(hit)
if hit.Parent and game.Players:GetPlayerFromCharacter(hit.Parent) then --We are checking if it's a player.
if not Pressed then --We used that variable above if it's not touched.
p = game.Players:GetPlayerFromCharacter(hit.Parent) --We gather the player who touched the part.
p.leaderstats['Score'].Value = p.leaderstats['Score'].Value + 1 --We gather their leaderstats and look for 'Score'. If you have another you can name 'Score' to the other Value.
Pressed = true --We turn true on and it will pause because we're checking for the false state.
wait(2)--Wait 2 seconds and then it turns on. (You can change this number to an amount of seconds you want it to wait.)
Pressed = false --Then we turn the brick back on to award a Score point.
end
end
end)
Hopefully this will help you! :) Good luck!
Make sure to accept the answer if it works!
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Works!But i don't know why my script didn't work
You were missing the functionality of the script. 'if Part.Touched == true then' doesn't fit the requirements for it.