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

Why doesn't this create a part who's parent is the character?

Asked by 9 years ago

I have a script (should it be in local script or reg.?). It is in the starter pack... it is supposed to make a block called "Catch" and the parent of "Catch" is the player... that's not what is happening!

wait(0.5)
catch = Instance.new("Part")
catch.Name = "Catch"
catch.Parent = script.Parent.Parent.Character
catch.CanCollide = false

See any problems? Should it be in a local script or regular script? Please help!!! Thank you!!!

1 answer

Log in to vote
1
Answered by
Diitto 230 Moderation Voter
9 years ago

The script should be a LocalScript, since it's affecting the player that gets it.

And the part should be parented to the character. Maybe the issue you think that you are getting is that the part is not near the player.

catch.Position = script.Parent.Parent.Character.Torso.Position

Oh, and if you're not seeing the part in the character, the issue could be that the part is falling through the world due to being intangible and not anchored.

catch.Anchored = true

Fixed example:

wait(.5)
local Player = Game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait() 
--// Waits for the character if it doesn't exist yet.
local catch = Instance.new("Part")
catch.Name = "Catch"
catch.CanCollide = false
catch.Anchored = true
catch.Position = Character:WaitForChild("Torso").Position
--// Waits for the Torso if it doesn't exist yet.
catch.Parent = Character
0
If FilteringEnabled is on, putting it in a LocalScript will mean that no one else will be able to see or interact with the part. chess123mate 5873 — 9y
Ad

Answer this question