local LocalTextButton = script.Parent.Parent:WaitForChild("CurrentHave")
local GlobalTextButton = script.Parent
local RemotesFolder = game:GetService("ReplicatedStorage"):WaitForChild("Remotes")
local ItemUpdaterRemote = RemotesFolder:WaitForChild("ItemUpdater")
local TeamUpdaterRemote = RemotesFolder:WaitForChild("TeamUpdater")
local LocalPlayer = game:GetService("Players").LocalPlayer
TeamUpdaterRemote.OnClientEvent:Connect(function(Team)
print('aaaaaahhhhhhhhh')
end)
A localscript in a screengui in startergui, the teamupdater wont print aaahh in this script, but in a localscript in starterplayerscripts it will print aaah
Any other remote works but its literally this specific function that wont work at all for no reason
how the hell do you structure your game?
You have to ping server from client that its ready to recive such remote first.
Dude…Just stop reinventing damn wheel
From the server. My issue right now is the .onclientevent wont work, i want to detect when the team is changed, ive tried getpropertysingalchanged but none of it works in startergui for some reason
I see. Here are scripts that would work that you could implement into your code:
Server:
local RemotesFolder = game:GetService("ReplicatedStorage"):WaitForChild("Remotes")
local TeamUpdaterRemote = RemotesFolder:WaitForChild("TeamUpdater")
game.Players.PlayerAdded:Connect(function(Player) -- Detect when player joins
Player:GetPropertyChangedSignal("Team"):Connect(function() -- Detect on property changes
TeamUpdaterRemote:FireClient(Player, Player.Team) -- And fire the client
end)
end)
And then your current client script should work, let me know how it goes :))
The folders may not load quickly enough. Here’s an updated script:
local RemotesFolder = game:GetService("ReplicatedStorage"):WaitForChild("Remotes")
local TeamUpdaterRemote = RemotesFolder:WaitForChild("TeamUpdater")
for _, i in pairs(game.Players:GetPlayers()) do
Player:GetPropertyChangedSignal("Team"):Connect(function() -- Detect on property changes
TeamUpdaterRemote:FireClient(Player, Player.Team) -- And fire the client
end)
end
game.Players.PlayerAdded:Connect(function(Player) -- Detect when player joins
Player:GetPropertyChangedSignal("Team"):Connect(function() -- Detect on property changes
TeamUpdaterRemote:FireClient(Player, Player.Team) -- And fire the client
end)
end)
This script checks for all players even after everything is loaded.
Could you tell us where you are changing the player’s team? It’s very important because if you were to change it in a localscript / on the client, the server would not detect it and therefore will not fire the remote event.
I used the exact same scripts as yours and it worked perfectly fine for me so i’m guessing this could be the problem…?