Bomb spawning tool not working

  1. What do you want to achieve? Keep it simple and clear!

A tool that spawn bomb in front of player

  1. What is the issue? Include screenshots / videos if possible!

it doesn’t want to spawn

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I try looking for solutions but still don’t know

local storage = game:GetService("ServerStorage")
local bomb = storage.Bomb
local ply = script.Parent.Parent.Parent.Parent
local isply = workspace:WaitForChild(ply.Name)
local humrp = ply:WaitForChild("HumanoidRootPart")

script.Parent.OnServerEvent:Connect(function()
	local pos = humrp.Position
	local Clone = bomb:Clone()
	Clone.Position = Vector3.new(pos - Vector3.new(0,0.5,0))
	Clone.Anchored = true
	Clone.Parent = game.Workspace
end)
1 Like

i don’t see anything wrong, maybe there’s an error in output, if so then would be good if you showed it so i can try to help. The only thing i’m not sure about is position, i don’t know might be right, might be wrong. If there no errors check if the bomb is in the workspace after your remote function runs, if so then it’s just positioned badly, try to do like this
Clone.CFrame = humrp.CFrame + (humrp.CFrame.lookVector * 5)

Upon taking a look at your code and testing it out myself it turns out that the code you wrote checks the player object. Also if I understood right, the code is inside the tool? If that is the case, here is the code. Hopefully, that is what you wanted.

local storage = game:GetService("ServerStorage")
local bomb = storage.Bomb


script.Parent.OnServerEvent:Connect(function(p)
	local character = p.Character
	local humrp = character:WaitForChild("HumanoidRootPart")
	local pos = humrp.Position
	local Clone = bomb:Clone()
	Clone.Position = pos - Vector3.new(0,0.5,0)
	Clone.Anchored = true
	Clone.Parent = game.Workspace
end)
1 Like