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

Why this localscript is not working?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

**The script should make a Part that go into the model StoreModel, but dont do anything. There is no error just that the part does no create :S

THE SCRIPT IS INTO A LOCALSCRIPT THAT IS IN STARTERGUI**

local Player = game.Players.LocalPlayer:WaitForChild("Character")
local rArm = Instance.new("Part",Workspace.StoreModel)
rArm.CanCollide = true
rArm.Anchored = false
rArm.BottomSurface = "Smooth"
rArm.TopSurface = "Smooth"
rArm.Position = Player:FindFirstChild("Right Arm").Position

1 answer

Log in to vote
0
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
9 years ago

The Character is not a child of the player. It's a property.

WaitForChild will simply wait forever.


You have to cause it to wait yourself:

while not player.Character do
    wait()
end

Or, if you're willing to restructure your code a little, you can use the CharacterAdded event (though this makes things slightly more complicated, too).

Ad

Answer this question