I have a script inside of a string value, the string value is inside of a folder and the folder is inside ReplicatedStorage. I have a simple function inside the script that checks if the string value changed. If it does I want to run another function. The thing is that the script doesn’t even run.
I have tried just doing
print("Test")
at the top of the script. But even that doesn’t do anything…
Does anybody know why it won’t actually run the code?
I’ll show u the code I have inside the script but it has nothing todo with the problem.
print("Script loaded at the top line")
local function Winners()
print("Round is over")
wait(3)
for i, v in pairs(game.Workspace.Statues:FindFirstChild("1"):GetChildren()) do
if v:IsA("Model") then
v:Destroy()
end
end
for i, v in pairs(game.Workspace.Statues:FindFirstChild("2"):GetChildren()) do
if v:IsA("Model") then
v:Destroy()
end
end
for i, v in pairs(game.Workspace.Statues:FindFirstChild("3"):GetChildren()) do
if v:IsA("Model") then
v:Destroy()
end
end
local statues = game.Workspace.Statues
local winners = game.ReplicatedStorage.Winners
local win1 = winners.Winner1.Value
local win2 = winners.Winner2.Value
local win3 = winners.Winner3.Value
if win1 ~= "" then
statues:FindFirstChild("1").name.SurfaceGui.SIGN.Text = win1
end
if win2 ~= "" then
statues:FindFirstChild("2").name.SurfaceGui.SIGN.Text = win2
end
if win3 ~= "" then
statues:FindFirstChild("3").name.SurfaceGui.SIGN.Text = win3
end
if win1 ~= "" then
local char = game.Workspace:WaitForChild(win1)
char.Archivable = true
print(char.Name)
local clone = char:Clone()
clone.Name = "Winner1"
clone.HumanoidRootPart.Position = statues:FindFirstChild("1").Pos.Position
clone.HumanoidRootPart.Orientation = Vector3.new(0, 0, 0)
clone.Parent = statues:FindFirstChild("1")
clone.HumanoidRootPart.Anchored = true
end
if win2 ~= "" then
local char = game.Workspace:WaitForChild(win2)
char.Archivable = true
local clone = char:Clone()
clone.Name = "Winner2"
clone.HumanoidRootPart.Position = statues:FindFirstChild("2").Pos.Position
clone.HumanoidRootPart.Orientation = Vector3.new(0, 0, 0)
clone.Parent = statues:FindFirstChild("2")
clone.HumanoidRootPart.Anchored = true
end
if win3 ~= "" then
local char = game.Workspace:WaitForChild(win3)
char.Archivable = true
local clone = char:Clone()
clone.Name = "Winner3"
clone.HumanoidRootPart.Position = statues:FindFirstChild("3").Pos.Position
clone.HumanoidRootPart.Orientation = Vector3.new(0, 0, 0)
clone.Parent = statues:FindFirstChild("3")
clone.HumanoidRootPart.Anchored = true
end
end
script.Parent.Changed:Connect(Winners)
print("Script loaded")
If you know why the script doesn’t run, please tell me!