Search
 
SCRIPT & CODE EXAMPLE
 

LUA

Best way to get player from character?

-- Do it easy bro
game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(Character)
		print(plr)
        print(Character)
	end)
end)

-- There is more events like part.Touched to get the player too
-- Notice now we get the player searching the name of it? Thats how you get it
local myPart = script.Parent -- This Script is in a part from the Workspace
myPart.Touched:Connect(function(hit) -- Player touches the thing 
	local character = hit.Parent
	local humanoid = character:FindFirstChild("Humanoid")
	local player = game.Players:FindFirstChild(char.Name)
    
    -- Prevent other stuff touching that part to trigger your code
    if humanoid then
      -- Kill Player MUAHAHA
    end
end)
Comment

PREVIOUS NEXT
Code Example
Lua :: get index of value in table lua 
Lua :: lua f animation 
Lua :: how to make scroll frame auto scroll roblox 
Lua :: lua wait function 
Lua :: lua push to aray 
Lua :: cmder not taking lua file 
Lua :: lua call custom function 
Lua :: lua string 
Lua :: type lua 
Lua :: how do i use the enums module lua assist 
Lua :: awesomewm wibar configuration transparent 
Lua :: how to make a math text in lua 
Lua :: lua run string as code 
Matlab :: matlab font size axis 
Matlab :: matlab delete file 
Matlab :: display sequence in matlab 
Matlab :: matlab exclamation mark 
Basic :: tmux basic commands 
Basic :: dos assign command output to variable (when output is a single line) 
Elixir :: elixir defguard 
Elixir :: liveview component mount 
Scala :: scala get file from url as string 
Scala :: how to make anonymous function in scala 
Actionscript :: how to take value only from the checked checkbox 
Excel :: excel auto fit row height 
Perl :: perl for 
Pascal :: wait for input in pascal 
Powershell :: powershell remove node_modules 
Clojure :: clojure 
Assembly :: json vulnerabilities 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =