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

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

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

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

1 comment

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.

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