Weapon spawner spawning invisible tools

As you can see in the video, the potion spawner is working fine. In the weapon I use the hitbox as the handle and connect the mesh with motor6d. (not with the potions because there’s no need to use a hitbox). and I’m guessing that’s what it to spawn invisible but I cant find a way to fix it.

Here’s the spawner script

part = script.Parent
Rs = game:GetService("ReplicatedStorage")
Weapons = Rs.WeaponsFolder

function SpawnRandomWeapon()
	local WeaponsTable = Weapons:GetChildren()
	local RandomWeapon = WeaponsTable[math.random(1, #WeaponsTable)]
	local WeaponClone = RandomWeapon:Clone()
	WeaponClone.Parent = workspace
	WeaponClone.Handle.Position = part.Position
end

while wait(math.random(1, 2)) do
	SpawnRandomWeapon()
end

This is what’s inside a weapon
image_2024-05-02_115828141

Maybe go to explorer and check out the properties? Or find where your parts went in server mode?

I did. the potion spawner is exactly the same code and it works fine. I think it’s something with the hitbox and model being welded.

Test it by grabbing a copy of the tool, place it on the floor where its visible!! See things happening in real time! :point_up:t2::smiley:

Its parent is the workspace

Did you see any unusual activity within the parts inside your tool?

Is that the handle thats being highlighted? The only part in the tool?

Make sure you weld everything first, or you can try setting collision to true for every part in the tool to see if they can weld or not.

look at the image I sent at the top of this topic

I assumed that the parts weren’t collide able.

It could be the transparency of the parts too.

I found where the model is going. its spawning in the tool position (before its spawned). so if I put the tool at 0,0,0, and the spawner at 0,2,0, the Handle will spawn at 0,2,0, but the Model will spawn at 0,0,0. Hope that makes sense lol. Tried to put the position of the model as the position of the handle, but the tool grip is now wonky.

To test that theory, make a 2 part tool thats welded together

Clone the tool

And then we position the handle somewhere else, see if has the same results

You can also apply the tool’s grip right after the positioning

pop
image_2024-05-02_131244175
They spawn in two different locations. the green part above is the spawner. they are welded together

1 Like

Instead of position, we can use cframe

  WeaponClone.Handle.CFrame = part.CFrame
end

I cant test it myself, im on my phone, give it a shot!! :face_with_monocle:

1 Like

wow such a simple yet effictive fix :rofl: thank you very much

1 Like

did it work? I am trying to find this solution myself too in the future

Yes it worked. weapons are spawning fine too.

1 Like

Greeeaat!!! You also taught me something too today, have fun developing!!:smiley:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.