RemoteEvent will not Fire

RemoteEvent will not Fire
Am trying to make a voting thing

local VoteEZ = VoteGUI.Container.VoteButtonEZ
local VoteNormal = VoteGUI.Container.VoteButtonNormal
local VoteHard = VoteGUI.Container.VoteButtonHard
local VotingEvent = VoteGUI.VotingEvent

VotingEvent.OnServerEvent:Connect(function(plr, choice)
	
	plr:WaitForChild("Vote")
	if choice == "choice1" then
	VoteEZ.TextLabel.Text = VoteEZ.TextLabel.Text + 1
	elseif choice == "choice2" then
	VoteNormal.TextLabel.Text = VoteNormal.TextLabel.Text + 1
	elseif choice == "choice3" then
	VoteHard.TextLabel.Text = VoteHard.TextLabel.Text + 1
	end
end)

This what i have in ServerScriptService

script.Parent.Activated:Connect(function()
	script.Parent.Parent.Parent.VotingEvent:FireServer(game.Players.LocalPlayer, "choice1")
end)

This what i have in a LocalScript
the text button is activated it just won’t fire the event

1 Like

Hmm i see that you are doing the things in a wrong way, first you don’t need to define the Player in FireServer also i see you are trying to add + 1 in string and it gonna return in a error.

2 Likes

By default, whenever you fire an event to the server, you automatically send the player information as well as the information you want to send. Because you’re using game.Players.LocalPlayer, it’s mistaken as the parameter choice in the server script. I recommend removing the game.PlayersLocalPlayer to solve this problem.

1 Like

I’ve tried removing game.PlayersLocalPlayer it hasn’t worked

1 Like

Did you saw the console? it should throw something

1 Like

the console, it has not throw something

1 Like

Okay then you need to start debugging adding prints at the start of the OnServerEvent and at the end

1 Like
local VoteEZ = VoteGUI.Container.VoteButtonEZ
local VoteNormal = VoteGUI.Container.VoteButtonNormal
local VoteHard = VoteGUI.Container.VoteButtonHard
local VotingEvent = VoteGUI.VotingEvent

VotingEvent.OnServerEvent:Connect(function(plr, choice)
	print("starting vote", plr, choice)
	plr:WaitForChild("Vote")
    print("continue voting")
	if choice == "choice1" then
	VoteEZ.TextLabel.Text = VoteEZ.TextLabel.Text + 1
	elseif choice == "choice2" then
	VoteNormal.TextLabel.Text = VoteNormal.TextLabel.Text + 1
	elseif choice == "choice3" then
	VoteHard.TextLabel.Text = VoteHard.TextLabel.Text + 1
	end
    print("ended)
end)
1 Like

Try this and tell me what happens when you do FireServer

1 Like

none of the prints went through or in the console

1 Like

can you show the explorer? need to check something

image
image

Okay now i can say that maybe the reason can be that you are using ServerScript in Startergui, you need to do things separately between client and server.

VotingService in ServerScriptService

Need to remake the entire system actually, I could make a folder with 3 Different NumberValues called Easy, Normal and Hard, next need to define the gui in client, and only change values in server via RemoteEvent like adding a vote or removing. I know that i didn’t explained so well but if you have a question ask it.

I will remake the system more characters

try placing it in replicatedstorage, possible reason for this is placement

reason it worked with my original design for my voting system
thanks everyone

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.