What I am trying to do is when you click a button it should update a StringValue.
The only issue is you got to click two times for the string value to update.
I need assistance if anyone knows how to fix this issue?
Script
local teamEvent = game:GetService(“ReplicatedStorage”):WaitForChild(“ApplyTeam”)
local Teams = game:GetService(‘Teams’):GetChildren()
teamEvent.OnServerEvent:Connect(function(plr,name, teamcolor, Id)
local team = game.Teams:FindFirstChild(name)
if team then
plr.Team = team
plr.Character.Head.RankGui.Frame.RANK.Text = plr:GetRoleInGroup(Id)
plr.plrStats.TeamId.Value = Id
plr.Character.Humanoid.Health = “0”
else
local team = Instance.new(“Team”)
team.Name = name
local existingTeam = game.Teams:FindFirstChild(name)
team.TeamColor = teamcolor
team.Parent = game.Teams
team.AutoAssignable = false
plr.Team = team
plr.Character.Humanoid.Health = “0”
end
Local Script
teambtn.MouseButton1Click:Connect(function()
team.Name = “Federal Bureau of Investigation”
team.TeamColor = BrickColor.new(“Storm blue”)
local Id = FBI
teamEvent:FireServer(team.Name, team.TeamColor, Id)
end)