jnrboomer.blogg.se

Get character from player roblox
Get character from player roblox





ValueObject. If valueObject then - If the value you're storing inside of the player can be found, then. Local valueObject = player:FindFirstChild("NameOfValueHere") - This will look for something inside of the player instance called "NameOfValueHere" If player then - If it was a player's Character that touched the part, then. Local player = Players:GetPlayerFromCharacter(objectThatTouchedThePart.Parent) - This will check if the parent of the object that touched the part is a Character model that belongs to a player Touched event, we will be able to reference the object that touched the part.

get character from player roblox

Local function partTouched(objectThatTouchedThePart) - Creates a function called "partTouched". Local part = script.Parent - Assuming the script is directly in the part, script.Parent will refer to the part that players will step on

get character from player roblox

Here’s an example: local Players = game:GetService("Players") - References the Players service This will allow you to access the Player and any values/folders/etc. Ok so the title doesn’t really describe it all but what I want my tool to do is to be able to detect all the tools a player has (done) and then pick a random tool local Tool script.Parent Tool.Activated:Connect(function() local Char local Player game.Players:FindFirstChild(Char. In order to access the Player instance from their Character, you can utilize a method of the Players service called :GetPlayerFromCharacter().







Get character from player roblox