I don’t know how to make a gun work I tried all the following
Trying it my self
Watching tutorials
The tutorials I watched didn’t work or had ALOT of bugs, I don’t want to use a free model since I wanna be orignal, I wanted to make a pistol that has ammo, shoot speed, reload speed, and aimming, is there anyone that can help me out with this I am a decent scripter but not that good.
i know you said you dont want a “free model” i suggest using one and just modifying it to your needs. Thats what i am currently doing and i modified it so heavily that you dont even notice its a free model. Also using free models isnt a bad thing thats how i mostly learned scripting overall im also bad like you also watching gun tutorials didnt help all they did was those really bad 2004 guns.
There is actually a really good weapon system made by roblox that I was planning on using in a future title of mine. It’s a 3rd person weapon system and it’s used in this fortnite demo:
I believe you can get the scripts somewhere else based on what I read in the code but really all you need to copy to your baseplate from that is the Replicated Storage, ServerStorage, Tools, and workspace folders. Actually it’s been a while, I’m not really even sure if workspace has a model, but it’s a good gun system.
I watched the vid and copied it down it works well but theres alot of bugs.
Then I watched Gamer M8’s vid on this but inproved version of TheEvilDuck’s scripts his also had bugs every time you re-equip the gun it bassically fires of 2 bullets and re-equip again it fires of 3 and etc but dmg is same but it takes more bullets when u re-equip and u could spam click on a player to bassically instantly kill them I don’t know how to make it so you can’t fire off bullets every second or something
This is Gamer M8’s script
Main script (Local Script)
`
local maxAmmo = 15
local Ammo = maxAmmo
local reloading = false
local player = game.Players.LocalPlayer
local playerGui = player:WaitForChild(“PlayerGui”)
local textLabel = playerGui:WaitForChild(“M9AmmoDisplay”):FindFirstChild(“AmmoText”)
script.Parent.Equipped:Connect(function(Mouse)
local function reload()
reloading = true
wait(1)
Ammo = maxAmmo
reloading = false
end
script.Parent.Activated:Connect(function()
if Ammo > 0 and not reloading then
Ammo = Ammo - 1
script.Parent.GunShot:Play()
if Mouse.Target.Parent:FindFirstChild("Humanoid")then
script.Parent.DealDamage:FireServer(Mouse.Target.Parent, 10)
end
elseif reloading == false then
reload()
script.Parent.GunShot:Stop()
end
while wait()do
textLabel.Text = (Ammo).."/"..maxAmmo
end
end)
local Input = game:GetService("UserInputService")
Input.InputBegan:Connect(function(Key)
if Key.KeyCode == Enum.KeyCode.R and reloading == false and Ammo ~= maxAmmo then
reload()
end
end)
id never recommend copying something if you dont know what it means/ how to fix it, take some time to learn raycasting and the mouse object and you should have a good idea how it all works
You’d want to generally learn how to raycast, how to use UserInputService or ContextActionService (I recommend knowing both since sometimes one is more useful in a scenario like creating buttons on mobile in ContextActionService). The speed and ammo generally comes to basic arithmetic as well as reload speed.
You can fixate your camera to have the player aim, if you’re aiming for a FPS then there are FPS tutorials on this forum and you would move the gun to the center of the camera to make it look like it’s aiming and for third person, I’m going to bet it’s just zoom the camera further in.
Also, this question was very generic, if you need more specific answers be sure to detail it better. For example, if you wanted to make a FPS then specify you want to create a gun for a FPS game and so forth.