Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would I find out the player's name? problem I can't solve

So let me give you a little explanation.

PICTURE

inside the starterpack there's a localscript called "smash" inside smash there's a part that will go into the workspace when the move is used,

shock = script:FindFirstAncestor("shock")

shock.Touched:Connect(function(prt)
	--script
	if prt.Parent.Name ~= PLAYER.Name then
	--script
	end
	end
end
end)

this is the damage script.it needs to know who the player is and i have no clue how to find out who the player is, i cannot use script.parent until i reach the player because when the script is going to be used is when it's parent is the workspace.

any clue on how to find the player that used the move?

6 comments

0

script:FindFirstAncestorWhichIsA("Player").Name

0

i dont think you understood my explanation THAT WONT WORK

0

I recommend putting a value in it with the players name on it

0

redommander, that's what i tried doing but i have no way of finding out the player's name, do I?

0

Yes you can. GetPlayerFromCharacter, then find Player.Name

0

w i l l n o t w o r k

1 answer

Since your using a local script you can simply just do

Local Plr = game.Players.LocalPlayer

Local Name = Plr.Name

Then you can simply add name to where ever

2 comments

0

you should learn lua before you answer.

0

I already know for sure that you can get game.players.localplayer from localscript. There was literly no reason to down vote me.

This discussion is preserved as it was. New answers, comments, and votes are closed.