Hey gamers,
In my team change GUI, the SV that stores the team remains unchanged after I SelectedTeam.Value = "team"
. How would I go about changing this? It’s imperative that it’s a client-sided change and doesn’t replicate to the server.
Hey gamers,
In my team change GUI, the SV that stores the team remains unchanged after I SelectedTeam.Value = "team"
. How would I go about changing this? It’s imperative that it’s a client-sided change and doesn’t replicate to the server.
Where is the string value located in the game? Nvm i see. if its under the players UI you can change it with a local script and it wont change for the server cause its done by a client
It seems to not change at all. Printing it immediately after the line of code that should change it returns with the unmodified value.
local TeamValue = "Pathtovalue"
TeamValue.Value = "Team"
this is very basic if it doesnt work it isnt the script thats broken its something within the UI. Also if you do the print with the server the server will not get the updated value as the change is done only on the client, not sure if thats your case but if so get the server to change it on the client. The change will only be for that client the difference being the server can now access said value
Found the issue (?). It changes on the client, however it seems to go back to the default value when I pass this change on to the remote event.
I can’t seem to find what’s causing this issue.
Here’s the script that fires the remote event:
local plr = game:GetService("Players").LocalPlayer
local team = script.Parent.Parent.SelectedTeam.Value
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
script.Parent.MouseButton1Click:Connect(function()
print(game.StarterGui.Menu.Buttons.SelectedTeam.Value) --it works fine here
game:GetService("ReplicatedStorage").LoadCharacter:FireServer(team)
end
end)
Here’s the script that’s run when the remote event is fired:
local RStorage = game:GetService("ReplicatedStorage")
local Teams = game:GetService("Teams")
RStorage.LoadCharacter.OnServerEvent:Connect(function(plr, team)
print(team) --but not here
local FoundTeam = Teams:FindFirstChild(team)
plr.Team = FoundTeam
plr:LoadCharacter()
end)
Any ideas?
Don’t use StarterGui; getting the contents on the player’s screen is done from Player:WaitForChild("PlayerGui")
. StarterGui is just where the content is initially stored before it gets copied and replicated to incoming clients
yes if you want to make a change to the client ui to player.PlayerGui
it works… I literally commented next to that “it works fine here”
These are two different StringValue Instances; one is in StarterGui and the other is in PlayerGui
when I change local team = script.Parent.Parent.SelectedTeam.Value
to local team = plr:WaitForChild("PlayerGUI").Main.Buttons.SelectedTeam.Value
I see in the output Infinite yield possible on 'Players.Fox_2042:WaitForChild("PlayerGUI")'
. How do I fix this?
“PlayerGui”
playerGui is a property not a child you cant wait for it.
That’s incorrect; It’s a child, not a property
Oh yea you’re right. I’ve just considered it a property for a long time because it’s basically auto-created when a player joins so you don’t need to wait for it to load
thanks :3
worked, but now nothing happens after defining team
It’s because it’s case-sensitive.
You CAN wait for the PlayerGui
, you just need to write it correctly.
Write PlayerGui
instead of PlayerGUI
in your code.
Try modifying your code to this:
local plr = game:GetService("Players").LocalPlayer
local team = script.Parent.Parent.SelectedTeam -- only reference the Instance here
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
script.Parent.MouseButton1Click:Connect(function()
game:GetService("ReplicatedStorage").LoadCharacter:FireServer(team.Value) -- use '.Value' here to get the up-to-date value stored.
-- if you define team as 'StringValue.Value' it was only store the value that's in place when the game starts
end)
It fixes the “nothing happens” problem, but the value still remains unchanged
i’ve had to sanity check myself twice and make sure I was in fact changing it lmaoa
Is it being changed from the properties window, or from another script?
Hear me out with this new way cause this seems to be causing you a lot of issues.
You don’t have to add or change anything from your code and it’s simple too.