how to make a function and all i know i think its
local function function()
but i dont know how to make the function do something and i need a function to reset all the votes after pressing a button
local Percent = game.Workspace.Values.Percent
local timer = game.Workspace.Values.Time
local Votes = script.Parent.Value
local Voted = false
local Skip = script.Parent
local Plrs = tostring(#game.Players:GetPlayers())
local NumOfPlrs = game.Workspace.Values.Players
Skip.Text = "Skip Map: "..Votes.Value.."/"..tostring(#game.Players:GetPlayers())
NumOfPlrs.Value = Plrs
Skip.MouseButton1Click:Connect(function()
if Voted == false then
Votes.Value = Votes.Value + 1
Voted = true
Skip.Text = "Skip Map: "..Votes.Value.."/"..tostring(#game.Players:GetPlayers())
else
Votes.Value = Votes.Value - 1
Voted = false
Skip.Text = "Skip Map: "..Votes.Value.."/"..tostring(#game.Players:GetPlayers())
end
if Percent.Value == 100 then
timer.Value = 1
end
Percent.Value = Votes.Value / NumOfPlrs.Value * 100
if Percent == 100 then
local function Reset() -- here
wait(1)
print("All Players Voted")
Reset()
end
end
end)
yea but how would i assign the Reset function to accually reset the votes
have the function outside your button1click script and then just set votes to 0 i guess?
DShadeyy
(DShadeyy)
#5
local Percent = game.Workspace.Values.Percent
local timer = game.Workspace.Values.Time
local Votes = script.Parent.Value
local Voted = false
local Skip = script.Parent
local Plrs = tostring(#game.Players:GetPlayers())
local NumOfPlrs = game.Workspace.Values.Players
Skip.Text = "Skip Map: "..Votes.Value.."/"..tostring(#game.Players:GetPlayers())
NumOfPlrs.Value = Plrs
Skip.MouseButton1Click:Connect(function()
if Voted == false then
Votes.Value = Votes.Value + 1
Voted = true
Skip.Text = "Skip Map: "..Votes.Value.."/"..tostring(#game.Players:GetPlayers())
else
Votes.Value = Votes.Value - 1
Voted = false
Skip.Text = "Skip Map: "..Votes.Value.."/"..tostring(#game.Players:GetPlayers())
end
if Percent.Value == 100 then
timer.Value = 1
end
Percent.Value = Votes.Value / NumOfPlrs.Value * 100
if Percent == 100 then
local function Reset() -- here
wait(1)
print("All Players Voted")
Skip.Text="Map:"..MapChosen.Value..
end
Reset()
end
end)
DShadeyy
(DShadeyy)
#6
There, if this doesn’t work. Then i don’t know what will.