RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"make a pistol that works and make the bullets and guns."
-- server script local gun = script.Parent local bullet = script.Bullet local fireRate = 0.5 local fireTime = 0 function onKeyDown(player, key) if key == "Mouse1" then if time() - fireTime > fireRate then fireTime = time() local bullet = bullet:Clone() bullet.Parent = workspace bullet.CFrame = gun.CFrame * CFrame.new(0, 0, -2) * CFrame.Angles(math.rad(90), 0, 0) bullet:SetNetworkOwner(player) bullet:SetNetworkOwner(nil) local force = Instance.new("BodyForce") force.Parent = bullet force.force = Vector3.new(0, 0, -500) end end end game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) character.Humanoid.Died:Connect(function() gun.Parent = character.HumanoidRootPart end) end) player.Chatted:Connect(onKeyDown) end)