How to make this function local?

I edited the script that I originally sent to check for LocalPlayer, and it has a 2 second delay before a button can be pressed again.

1 Like

Hol’ up, HOW DID YOU DO THAT? It worked! I will mark this as the solution, thank you so much!
I am curious how did you do that?

Check if the player is the LocalPlayer when you retrieve it from the Touched signal.

if player == players.LocalPlayer then
    -- the player is the game client's LocalPlayer
end
1 Like

Hm I tried that some minutes before but that did not change anything :thinking:

1 Like

Notice how I grab the player, the player is checked simply from the hit part’s parent, you then retrieve it as you did before with GetPlayerFromCharacter. With the newfound player variable returned from that namecall method, you can check if the player is the LocalPlayer from there.

Maybe because i just made if player then instead of if player == game.player.localplayer then lol

I use this quite often it is the best way.

if typeof(player) == 'Instance' and player:IsA("Player") and player == players.LocalPlayer then

end
1 Like