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

How to get a specific player's character from their player?

Asked by 5 years ago
Edited 5 years ago

I'm trying to make a script that will "holster" a fake version of a weapon, welding it to their body when they unequip it. I can't "get" the character to establish a weld. Does anyone have a solution for this?


tool = script.Parent real = tool.Handle fake = real:Clone() backpack = tool.Parent player = backpack.Parent name = player.Name character = -- player character? attachpoint = character:FindFirstChild("LowerTorso") fake.Parent = character fake.Position = attachpoint.Position fake.Orientation = attachpoint.Orientation weld = Instance.new("Weld") weld.Part0 = attachpoint weld.Part1 = fake

Thank you in advance.

0
the parent of the backpack.. right? DinozCreates 1070 — 5y
0
yea NEXIUS10 13 — 5y
1
player.Character? DinozCreates 1070 — 5y

1 answer

Log in to vote
0
Answered by
danglt 185
5 years ago
weld = Instance.new("Weld")

weld.Parent = game.Players.Localplayer.Character
weld.Part0 = attachpoint
weld.Part1 = fake

or if you would rather the parenting to not be as that you can change it as

weld = Instance.new("Weld",game.Players.Localplayer.Character)

That should work.

Ad

Answer this question