Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Voting System Int value is not changing?

i have a remote event so when the player clicks something it votes and i have values on which one is being voted and it shows no error

script.Parent.Votes.OnServerEvent:connect(function(player, voted, selection)
	if selection == "p1" then
		script.p1.Value = script.p1.Value + 1
		
		if voted == true then
			script.p2.Value = script.p2.Value - 1
		end
		print("works")
	elseif selection == "p2" then
		script.p2.Value = script.p2.Value + 1
		
		if voted == true then
			script.p1.Value = script.p1.Value - 1
		end
		print("works")
	end
end)

Local script

game.ReplicatedStorage.Votes2.OnClientEvent:Connect(function()
	script.Parent.Image = ("http://www.roblox.com/Thumbs/Avatar.ashxx=100&y=100&Format=Png&username=%s"):format(game.Workspace.CurrentDebater1.Vaule)	
end)
script.Parent.MouseButton1Down:Connect(function()
	local pir = game.Players.LocalPlayer
	game.ReplicatedStorage.Votes:FireServer(pir , pir.Voted.Value, "p1")
	pir.Voted.Value = true
	script.Parent.TextLabel.Visible = true
	script.Parent.Parent.p2.TextLabel.Visible = false
	print("fired")
end)
wait(10)
game.Players.LocalPlayer.Voted = false

it says fired but not works

2 comments

0

you can't fire multiple times in one remote event!

0

sorry wrong lol|... i mean you can't add multiples variable in once remotevent i try it and it doesn't work!

1 answer

✓ Accepted answer

Well when you fire your remote event, your sending pir, pir.Voted.Value, and "p1". When remote functions or events are fired, they auto send the player as a variable in the first slot. So that means you can just remove the pir from your firing event. Right now the server script thinks voted is actually pir.

1 comment

0

Oh because i had player as a variablue and i didnt want to mess it up

This discussion is preserved as it was. New answers, comments, and votes are closed.