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

how to use character in localscript?

im trying to do

local pos = Instance.new("BodyPosition", game.Players.LocalPlayer.Character.Torso)
pos.Position = Vector3.new(0, 30, 0)

it wont create a new bodyposition in torso this or im stupid

1 comment

0

You didn't give tell it when to run the script. Try local Players =game:GetService("Players") ~Players.PlayerAdded:connect(function() then your code.

1 answer

This is how you can get the character in a LocalScript:

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

It's worth noting that Torso is not existent in R15. You could use HumanoidRootPart because it is always going to exist in both R6 and R15.

1 comment

0

im not using r15

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