Remote Event wont fire?

this issue has been bugging me all day and everyone who i ask has told me that my code should work as it is, i am very very confused.

so basically im making a voting system, and when the player clicks a vote button i need an event to be fired to the server to add to whatever topic they voted for.

below is the localscript located in the GUI:

local repStorage = game:GetService("ReplicatedStorage")
local voteInitate = repStorage:WaitForChild("promptVote")
local voteMade = repStorage:WaitForChild("VoteMade")
local plr = game.Players.LocalPlayer
local panel = script.Parent.VotePanel
local voting = false
local voted = false
local countdownDisplay = plr.PlayerGui.screenElements.players

function countdown()
    for i = 10, 0, -1 do 
        wait(1)
        countdownDisplay.Text = ("voting will begin in "..i.." seconds!")
    end
end

function startGame()
    
end

-----------------------------------------------------------------
local votePanel = script.Parent.VotePanel

local topicImages = {
    topic1 = votePanel.Story1,
    topic2 = votePanel.Story2,
    topic3 = votePanel.Story3
}

local buttonFolder = votePanel.Buttons

local voteButtons = {
    button1 = buttonFolder.Vote1,
    button2 = buttonFolder.Vote2,
    button3 = buttonFolder.Vote3
}

local voteNumValues = {
    topic1Votes = voteButtons.button1.Value,
    topic2Votes = voteButtons.button2.Value,
    topic3Value = voteButtons.button3.Value
}

function openPanel()
    panel:TweenPosition(UDim2.new(0.5,0,0.5,0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.5)
end

function closePanel()
    panel:TweenPosition(UDim2.new(-2,0,0.5,0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.5)
end

local topicNumber

voteInitate.OnClientEvent:Connect(function()
    if voting == false then
        countdown()
        openPanel()
        voting = true 
        voted = false
        countdownDisplay.Text = "Voting has begun! choose your favorite topic!"
    end
end)

voteButtons.button1.Activated:Connect(function()
    if voting == true and voted == false then
        print("firing event...")
        voted = true
        topicNumber = 1
        voteMade:FireServer(topicNumber)
    end
end)```

this checks if the player clicked the vote button and *should* fire the event, "firing event" is printed into the output as expected

here is the server script though:

```lua
local repStorage = game:GetService("ReplicatedStorage")
local voteMadeEvent = repStorage.VoteMade

voteMadeEvent.OnServerEvent:Connect(function(plr, topicNumber)
        print("Server event fired!")
    if topicNumber == 1 then
        print("the player "..plr.Name.." chose topic number "..topicNumber)
    end
end)```

--[[topicNumber is the value based on what button the player clicked, in this case its 1 for the first topic, -but "Server event fired!" is never printed, (yes, i did check to make sure that the script is enabled)

not really sure what this is but ive been trying to fix it all day and cant find a solution, hope someone can catch something im doing incorrectly]]--
1 Like

Does it input any errors in the output?

no, it does not output any errors

Can you include your other script that is meant to be firing?

ok so funny story, it turns out that this whole time ive been overlooking the server panel in the test server and it was working properly the whole time :expressionless: yay

Make sure to mark your post as solved.

2 Likes