Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Script Help (name)?

Asked by 8 years ago

I stehre away i could make a way so who clicked this object happens to them i dotn know how that works like i want it to be if a player name carl12345 touches it and the script does not have to have a name like game.workspace. then the name i want it to be random like minecraft you can do this give {name} dirt 1 in a command block

2 answers

Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
8 years ago

If you want to tell who clicked some object, you can use a ClickDetector inside of the object and connect to its MouseClick event which returns the player who clicked as a parameter.

Part.ClickDetector.MouseClick:connect(function(player)


end)

If you wanted to get the player from someone who touched something then it would be through a Touched event:

Part.Touched:connect(function(hit)
    local player=game.Players:GetPlayerFromCharacter(hit.Parent)
    if not player then return end


end)
Ad
Log in to vote
0
Answered by 8 years ago

Ok thanks I was young when I posted this I understand what you meant thanks 1waffle1

Answer this question