My game is currently in Beta and has a habit of breaking; I thought for the meantime, until the errors are fixed, I can install a function for voting to fix the game by the players. I thought of accomplishing this by making it so that the main script that runs the game is cloned and the original copy is deleted and replaced with the new one. However, when I do that, the new script just doesn't run. Why is that?
For the button:
script.Parent.MouseButton1Up:connect(function()
local value = script.Parent.Parent.Vote
if value.Value == true then
value.Value = false
else
value.Value = true
end
end
For the game reset:
--In the ServerStorage
while wait(.1) do
getPlayers = game.Players:GetChildren()
for i, v in pairs(getPlayers) do
if v.PlayerGui:FindFirstChild("FixButton") then
if v.PlayerGui.FixButton.Vote.Value == true then
script.Parent.Vote.Value = script.Parent.Vote.Value + 1
end
end
end
if script.Parent.Vote.Value >= math.floor(#(game.Players:GetChildren())*.75) then
replaceScript = game.Workspace.MainScript:Clone()
replaceScript.Disabled = true
game.Workspace.MainScript:Destroy()
getPlayers2 = game.Players:GetChildren()
for i, v in pairs(getPlayers2) do
if v.PlayerGui:FindFirstChild("FixButton") then
v.PlayerGui.FixButton.Vote.Value = 0
end
end
replaceScript.Parent = game.Workspace
replaceScript.Disabled = false
end
end

2 comments
Instead of a vote to fix, fix the problems in the first place.
Scripts cannot run in ServerStorage, that is your first issue. Next you're probably going to need some info on RemoteEvents because you're going to need them for this.