Hello. i need to admit I am quite a greenhorn when it comes to scripting, so I am seeking for help right now.

tool = script.Parent


function onButton1Down(mouse)

    local model = game.ServerStorage.Grenade:clone()
    model.Parent = game.Workspace
	model.PrimaryPart = model.Union
    model:MakeJoints()
    model:MoveTo(mouse.hit.p)
local cframe = model.PrimaryPart.CFrame -- CFrame with default rotation
model:SetPrimaryPartCFrame(cframe * CFrame.fromEulerAnglesXYZ(math.random(0,359), math.random(0,359), math.random(0,359)))

end

function onEquipped(mouse)
    mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end

tool.Equipped:connect(onEquipped)

This script is working properly. By every single click, it spawns a Model called Grenade where the mouse cursor is.

However, it can do it rapidly.

I wish to make the Tool have some sort of "timeout". By every spawn of Grenade, the tool stops working for about 1 second and then the player can spawn the Grenade again.

I would be glad if somebody helped me out.

Thank you.

2 comments

0

If you don't know how to implement a cool down but know how to clone things into workspace, know CFraming, know how to use Mouse, then this is a free model script. Plus, I've seen this same exact format in other scripts. Don't come on here with free model code, expecting for it to be fixed

0

Welp, if somebody knows quantum physics, it ain't a proof that he knows how sodium reacts with water. :/