Basically, I want to make a vote sort-of system, so I made a part that changes the “vote” value each time it’s touched. Issue is, though, I couldn’t find a way to make it so the value only changes once per player, so I opted to simply destroy the script. My current plan with this is basically to (attempt) make some sort of horrible mess and amalgamation of localscripts and remoteevents to get this to work(I’m currently using a normal script)
Anyways, enough rambling, this is the current script:
Why not just a server script that puts the player inside a table when they touch it for the first time and check if that player is in the table before doing anything?
local playersTouched = {}
function onTouch(part)
local player = game.Players:GetPlayerFromCharacter(part.Parent)
if player then
if playersTouched[player] then --// check if the player touched the part
return --// if the player touched the part already then stop
end
playersTouched[player] = true --// add the player to the table
local vote = workspace.Value --// use workspace its the same as game.Workspace but makes your code look nicer.
vote.Value = vote.Value + 1 --// you could also do vote.Value += 1 which is the same but again makes your code look nicer
end
end
Once you’re done with the voting you can just do table.clear(playersTouched)
I’ve tried your script, but it doesn’t seem to work. The value simply does not change. I’m quite a beginner, so please do ignore any monkey-brain moments on my part.