textlabel is not always being updated for everyone?
Asked by
5 years ago Edited 5 years ago
Hello, I'm trying to make a map vote system where multiple people can vote at the same time that limits each player to one vote and chooses the map with the most votes (the map choosing system is somewhere else in the script).
The problem is that; the textlabel doesnt update when there is more than one player trying to vote on the same thing or rather it does update but it doesnt update for other players until
they vote on something else
I thought FireAllClients() handles this? Why isn't the textlabel updating for everyone?
I put comments explaining everything that needs to be explained in the scripts below
(if the comments makes everything look confusing please tell me and ill remove them)
Local script
01 | voteFrame.MapImage 1. MouseButton 1 Click:Connect( function () |
03 | if playerVote.Value = = map 1. Name then |
04 | print ( "plr already voted for this" ) |
05 | elseif playerVote.Value ~ = map 1. Name and playerVote.Value = = map 2. Name then |
07 | playerVote.Value = map 1. Name |
11 | changeVoteEvent:FireServer( "VoteNum1" , "VoteNum2" , voteFrame.MapImage 1. MapName, voteFrame.MapImage 2. MapName, map 1. Name, map 2. Name) |
12 | elseif playerVote.Value ~ = map 1. Name and playerVote.Value = = map 3. Name then |
14 | playerVote.Value = map 1. Name |
17 | changeVoteEvent:FireServer( "VoteNum1" , "VoteNum3" , voteFrame.MapImage 1. MapName, voteFrame.MapImage 3. MapName, map 1. Name, map 3. Name) |
19 | playerVote.Value = map 1. Name |
21 | changeSingleVoteEvent:FireServer( "VoteNum1" , voteFrame.MapImage 1. MapName, map 1. Name) |
Server script that handles the value changes and the text label changes
01 | local function mapVoteEventFired(plr, target 1 , target 2 , text 1 , text 2 , map 1 , map 2 , otherValue, otherText, otherMap) |
04 | local target 1 = script:FindFirstChild(target 1 ) |
05 | local target 2 = script:FindFirstChild(target 2 ) |
06 | local otherValue = script:FindFirstChild(otherValue) |
07 | target 1. Value = target 1. Value + 1 |
08 | target 2. Value = target 2. Value - 1 |
09 | text 1. Text = map 1.. ": " ..target 1. Value |
10 | text 2. Text = map 2.. ": " ..target 2. Value |
11 | otherText.Text = otherMap.. ": " ..otherValue.Value |
14 | local function mapSingleVoteEventFired(plr, target, text, map) |
16 | local target = script:FindFirstChild(target) |
17 | target.Value = target.Value + 1 |
18 | text.Text = map.. ": " ..target.Value |
21 | changeSingleVoteEvent.OnServerEvent:Connect(mapSingleVoteEventFired) |
22 | changeVoteEvent.OnServerEvent:Connect(mapVoteEventFired) |