Very simple problem, everything in my script works just fine except for one line that is meant to add 1 onto a number value. I have the number values name right, it outputs no errors but just doesn’t add 1, anyone tell me why?
local Menu = script.Parent
local Teams = game:GetService("Teams")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TC = ReplicatedStorage:WaitForChild("TeamCreated")
local Team1 = Menu:WaitForChild("Team 1")
-- Rest must be filled in
local Value1 = Team1:WaitForChild("Value")
-- Rest must be filled in
local function CreateNewTeam(player)
print(player.Name .. " has created a team")
if Team1.Visible == false then
Team1.Visible = true
player.Team = game.Teams:FindFirstChild("Team 1")
print("Team 1 has been created")
Team1:WaitForChild("Username 1").Text = player.Name
Value1.Value = Value1.Value + 1
-- elseif "continues onto other teams"
end
end
TC.OnServerEvent:Connect(CreateNewTeam)
local Menu = script.Parent
local Teams = game:GetService("Teams")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TC = ReplicatedStorage:WaitForChild("TeamCreated")
local Team1 = Menu:WaitForChild("Team 1")
local function CreateNewTeam(player)
print(player.Name .. " has created a team")
local Value1 = Team1:FindFirstChild("Value")
if Value1 then
if Team1.Visible == false then
Team1.Visible = true
player.Team = game.Teams:FindFirstChild("Team 1")
print("Team 1 has been created")
Team1:WaitForChild("Username 1").Text = player.Name
Value1.Value += 1
-- elseif "continues onto other teams"
end
else
warn("WHY BURH UB URRHR")
end
end
TC.OnServerEvent:Connect(CreateNewTeam)
Okay I ran the script in serverscriptservice instead of inside the gui, it publicly changes the value, I guess roblox studio just doesn’t like server scripts being in startergui.