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

how to use character in localscript?

Asked by 6 years ago
Edited 6 years ago

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

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. TiredMelon 405 — 6y

1 answer

Log in to vote
0
Answered by
Avigant 2374 Moderation Voter Community Moderator
6 years ago

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.

0
im not using r15 lololjgjjgghg 0 — 6y
Ad

Answer this question