Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

event does not want to fire?

Asked by 5 years ago
Edited 5 years ago

Hello I hope you are having a blessed day but can you help me here I'm making a shotting game and I'm making a map vote system i made i sever event so if it is fired the vote get placed for that player and the hole sever sees that but it worked 100% until I made it so you can only vote 1 time here is the 2 scripts

---local script---

    DidVote = false

    script.Parent.MouseButton1Click:Connect(function()
    if not DidVote then
    DidVote = true
    game.ReplicatedStorage.Mapvote1:FireServer()
    end
    end)

I just change the "Mapvote1" to mapvote2 for the next button

---sever side script---

game.ReplicatedStorage.Mapvote1.OnServerEvent:Connect(function()
    if script.Parent.Parent.Parent.Mathdone.Value == true then
    script.Parent.Parent.whatmap.Value = script.Parent.Name
    script.Parent.votevalue.Value = script.Parent.votevalue.Value +1
    else
        local map = script.Parent.Parent.whatmap.Value
        script.Parent.Parent[map].votevalue.Value = script.Parent.Parent[map].votevalue.Value -1
        script.Parent.votevalue.Value = script.Parent.votevalue.Value +1
        end
end)

the scripts are in a Image button and the image button is in a frame that is in a ScreenGui

And this thing gives me NO ERRORS

and the hole thing does not work

please help

0
Put prints inside your server event the remote is firing but the if statements are false so its not continuing do some debug work to see which if statement is not working Arkrei 389 — 5y
0
Woah did you script this urself? HomieFirePGN 137 — 5y

1 answer

Log in to vote
0
Answered by
Prestory 1395 Moderation Voter
5 years ago
Edited 5 years ago

Instead of using the serverscript to check if the player has voted you can do this in the localscript using a variable like i have done below.

DidVote = false

script.Parent.MouseButton1Click:Connect(function()
    if not DidVote then
       DidVote = true
       game:GetService('ReplicatedStorage').Mapvote1:FireServer()
    end
end)

0
Im just ganna accept this because you helped me in my game like with team create like thank you so much GamerJanko 50 — 5y
0
Np Prestory 1395 — 5y
Ad

Answer this question