Why doesnt this script work

Hi why ist this script working litterly is it not full proof?

Client:

--client script is located in Replicated storage
wait(5)
script.Parent.SetPlayer:FireServer(function(Player)
	script.Parent.SetPlayer:FireServer(game.Players.LocalPlayer.Character.Name)
end)

Server:

--Server script is located in a r6 rig
local SP = game.ReplicatedStorage.SetPlayer

SP.OnServerEvent:Connect(function(Player, PlrName)
	print(PlrName)
	script.Parent.Name = PlrName
end)

I tried litterly everything like waiting for the player waiting for the character just waiting but NOTHING works it doesnt even print the players/characters name in the output like its supposed to

Client/local scripts doesn’t work in replicated storage, Put the script at StarterPlayerScripts and change it to this:

--client script is located in Replicated storage
wait(5)
local SP = game.ReplicatedStorage.SetPlayer
SP:FireServer()

the script all of it is just incorrect.
and for the server, you just need the player which is already passed.

--Server script is located in a r6 rig
local SP = game.ReplicatedStorage.SetPlayer

SP.OnServerEvent:Connect(function(Player)
	print(Player.Name)
	script.Parent.Name = Player.Name
end)
2 Likes

Instead of doing this roundabout mess just use playeradded instead

game.Players.PlayerAdded:Connect(function(player)
     -- do stuff to check if this is the correct rig
     script.Parent.Name = player.Name -- you can also use player.DisplayName
end)
3 Likes

Thank you all for your guys help!

1 Like