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

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

Asked by 6 years ago
Edited 6 years ago

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.

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. Ultimate_Piccolo 201 — 6y
0
oh, solved it. thanks! JamarMario 13 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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!

0
It did. Thank you! JamarMario 13 — 6y
Ad

Answer this question