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

How do I fix my story game voting system?

I'm making a voting system, I'm trying to update the number value when I fire the remote. When I do fire the remote, nothing happens. Any ideas to fix this?

Server Script (there are 3 number values in replicated storage)

local RS = game:GetService("ReplicatedStorage")

RS.Vote.OnServerEvent:Connect(function(voted)
	if voted == "Portal" then
		RS.Poll.Portal = RS.Poll.Portal + 1
	elseif voted == "Know" then
		RS.Poll.Know = RS.Poll.Know + 1
	elseif voted == "Human" then
		RS.Poll.Human = RS.Poll.Human + 1
	end
end)

Local Script

local vote = game.ReplicatedStorage.Vote
local WhatYouVoted
local debounce = false

script.Parent.Portal.Button.MouseButton1Click:Connect(function()
	if debounce == false then
		WhatYouVoted = "Portal"
		vote:FireServer(WhatYouVoted)
		debounce = true		
		script.Parent.Parent.Who.Visible = false
	end
end)

script.Parent.Human.Button.MouseButton1Click:Connect(function()
	if debounce == false then
		WhatYouVoted = "Human"
		vote:FireServer(WhatYouVoted)
		debounce = true
		script.Parent.Parent.Who.Visible = false
	end
end)

script.Parent.Know.Button.MouseButton1Click:Connect(function()
	if debounce == false then
		WhatYouVoted = "Know"
		vote:FireServer(WhatYouVoted)
		debounce = true
		script.Parent.Parent.Who.Visible = false
	end
end)

1 answer

✓ Accepted answer

I think this is the server script's problem. Perhaps this should work.

local RS = game:GetService("ReplicatedStorage")

RS.Vote.OnServerEvent:Connect(function(WhatYouVoted)
	if WhatYouVoted == "Portal" then
		RS.Poll.Portal.Value = RS.Poll.Portal.Value + 1
	elseif WhatYouVoted == "Know" then
		RS.Poll.Know.Value = RS.Poll.Know.Value + 1
	elseif WhatYouVoted == "Human" then
		RS.Poll.Human.Value = RS.Poll.Human.Value + 1
	end
end)

Portal, Know and Human should all be IntValues btw

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