Need help with script result false value

Uh hello it salmon again and i need help with something

So i got a problem when the output keep printing
image
here is the script

local script (in starterplayerscript)
local player = script.Parent.Parent

local name = player.Name

script(in server script service to handle the fireserver)

As you can see in the local script i am trying to use player name to find a button that same name to player and send it to server to delete it
(explain on why iam trying to do that is iam making an allies system and i dont want player to allies themself lol)

But it keep result player ? any explaination on this is appricated
Thanks

The player who fires a remote event is always the first parameter passed to the connection. All the parameters the client sent will be defined afterwards.

You should do:

:Connect(function(player, target)
1 Like

The first parameter of OnServerEvent is the client’s name
you should do this: OnServerEvent:Connect(function(player, target) to avoid printing the ClassName “Player”

To avoid giving allying themself, you should check if the player allying is same name with the player firing the event:

Instead of passing a button to the server, pass the player’s name (or the player, although player is the better solution, I’m going to do that in this topic)

And to check the player is not same with the target, do if player.Name ~= target then

Local Script:

local player = script.Parent.Parent

local name = player.Name
game.ReplicatedStorage.Events.FixBugEvent:FireServer(name)

Server Script:

game.ReplicatedStorage.Events.FixBugEvent.OnServerEvent:Connect(function(PlayerFiredFunction, AlliedPlayerName)
  if PlayerFiredFunction.Name ~= AlliedPlayerName then
    print("Player allied another player!")
  else
    print("The player tried to ally himself, get a partner 😂")
  end
end)

ok thats all, se ya

1 Like