I’m attempting to change a value via a script from ServerScriptService but it doesn’t change, strangely when I print the value it shows it has changed but it doesn’t show it in the workspace.
local event = game:GetService("ReplicatedStorage").StartRound
local eventD = game:GetService("ReplicatedStorage").Death
local eventD2 = game:GetService("ReplicatedStorage").Death2
local kill = game:GetService("ReplicatedStorage").Kill
repstor = game:GetService("ReplicatedStorage")
local isround = game.Workspace.GlobalVariables.IsRound.Value
event.OnServerEvent:Connect(function()
isround = "Yes"
print(isround)
local storage = game:GetService("ServerStorage")
local tools = storage.Tools
local function randomMurder()
local players = game:GetService("Players"):GetPlayers()
selectedMurd = players[math.random(1,#players)]
return selectedMurd
end
local function randomSheriff()
local players = game:GetService("Players"):GetPlayers()
selectedSher = players[math.random(1,#players)]
return selectedSher
end
-- Pick a Murderer
randomMurd = randomMurder()
print(randomMurd)
if randomMurd and randomMurd.Character then
randomMurd.Character.Variables.Role.Value = "Murderer"
local inv = randomMurd.Backpack
local clone = tools.Knife:Clone()
clone.Parent = inv
end
-- Pick a Sheriff
repeat
wait(1)
randomSher = randomSheriff()
print(randomSher)
until randomSher ~= randomMurd or isround == "No"
if randomSher and randomSher.Character then
randomSher.Character.Variables.Role.Value = "Sheriff"
local inv = randomSher.Backpack
local clone = tools.Revolver:Clone()
clone.Parent = inv
end
-- Make everyone else an Innocent
local players = game:GetService("Players"):GetPlayers()
for _, player in ipairs(players) do
player.Character.Variables.Role.Value = "Innocent"
end
end)