Hey so im trying to set Stage (S) as a variable and for some reason it just doesnt work. i did the same line for so many scripts and it just doesnt work for me.
here's the code:
`local ChangeOEvent = script.Parent.Parent.ReplicatedStorage.ChangeObbySpawn
ChangeOEvent.OnServerEvent:Connect(function(Player)
local players = game:GetService("Players")
local Cpoints = game.Workspace.CheckPoints:GetChildren()
local obbyv = game.StarterGui.InsertedObjects.ObbyButton.Value
local tycoonv = game.StarterGui.InsertedObjects.TycoonButton.Value
local Teams = game:GetService("Teams")
local Cpoints = game.Workspace.CheckPoints
local leaderstats = players:FindFirstChild("leaderstats")
local S = leaderstats:FindFirstChild("Stage")
if Player.Team == Teams.Red then
obbyv.Value = true
tycoonv.Value = false
if obbyv.Value == true then
local hum
Player.PlayerGui.InsertedObjects.ObbyButton.BackgroundColor3 = Color3.new(0.545098, 0.545098, 0)
Player.PlayerGui.InsertedObjects.ObbyButton.Shadow.BackgroundColor3 = Color3.new(0.282353, 0.282353, 0)
Player.PlayerGui.InsertedObjects.TycoonButton.BackgroundColor3 = Color3.new(255, 0, 0)
Player.PlayerGui.InsertedObjects.TycoonButton.Shadow.BackgroundColor3 = Color3.new(0.290196, 0, 0)
local char = Player.Character
if char then
hum = char:FindFirstChild("Humanoid")
Player.CharacterAdded:Connect(function(hum)
hum:MoveTo(Cpoints[S.Value].Position)
end)
end
end
end
end) `
