Hi! I need help to create a system like Fashion Famous where all the players take turns and going out one-by-one to the catwalk and the others have to give them a score from 1 to 5 for how they are dressed. At the end a podium is made with the 3 players with the highest score. I have searched many sites and I don’t understand how to do it.
EXAMPLES:
Sorry if I am not making myself clear.
3 Likes
Add a StringValue
in ServerStorage
named VoteTracker
. Add a RemoteEvent
in ReplicatedStorage
named Vote
.
In the voting GUI, add an IntValue
named Vote
and a LocalScript
:
local voteEvent = game:GetService("ReplicatedStorage"):WaitForChild("Vote")
local vote = path.to.VoteValue
--wait until the timer is over (your code)
local currentPlayer --the player to vote for
voteEvent:FireServer(currentPlayer, vote)
In ServerScriptService
, add a Script
:
local voteEvent = game:GetService("ReplicatedStorage").Vote
local votes = game:GetService("ServerStorage").VoteTracker
local function encode(t)
return game:GetService("HTTPService"):JSONEncode(t)
end
local function decode(s)
return game:GetService("HTTPService"):JSONDecode(s)
end
votes.Value = encode({})
local function reset()
local t = {}
for _, v in game:GetService("Players"):GetPlayers() do
t[v] = 0
end
votes.Value = encode(t)
end
reset()
voteEvent.OnServerEvent:Connect(function(player, target, vote)
local t = decode(votes.Value)
t[target] += vote
votes.Value = encode(t)
end)
--round ends
reset()
3 Likes