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

How do i create a specific part inside the user's torso?

I've been trying to create an specific part inside my torso that's stored in ServerStorage. however, i've been having problems (Workspace.JamarMario.Script:3: bad argument #1 to 'new' (string expected, got Object)). i need help with this one folks.

local damagingball = game.ServerStorage.damagingball
local shootsstuff = game.ServerStorage.shootsstuff
Instance.new(shootsstuff)
shootsstuff.Position = game.Players.LocalPlayer.Character.Torso.Position
shootsstuff.Anchored = true

there's other stuff down there but i don't think it's related to the problem since it's a completely different code.

2 comments

0

Your problem is you're trying to create an Instance of something that's in the game, but what you really want to do is shootsstuff:Clone() and then parent it to the player's torso. Sorry I'd answer and give a more thorough explanation if I wasn't so tired.

0

oh, solved it. thanks!

1 answer

When you use instance.new, you are creating a new instance (Ex.Part, Sound). You need to use :clone() instead. Here is what your script should look like:

local damagingball = game.ServerStorage.damagingball
local shootsstuff = game.ServerStorage.shootsstuff:clone()
shootsstuff.Position = game.Players.LocalPlayer.Character.Torso.Position

Note: This only makes the part's location to the player's torso position once. If they move, the part will stay where it originally was. You'll need to weld or attach it to the player's torso if you want to have it move with them.

Hope this helps!

1 comment

0

It did. Thank you!

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