How do I make a gun

(Couldn’t find an appropriate category for this)

Recently I am trying to make a gun and i searched up in the Youtube on how to make a gun.

All I got is how to use free models and how to make a low/mid ploy gun on ROBLOX.
People usually hire tutors to teach them how to make a gun(I guess) but I don’t have enough Robux to hire a tutor.

So i searched upon the dev forum on how can I make a gun.
I saw similar posts like this but couldn’t find an answer.

I wanted to know if anyone know a site or a Youtube video which shows how to make a gun(Not alvin_Blox’s)

2 Likes

I suggest making your first weapon using TweenService, for instance:

LocalScript:

local tool = script.Parent;

local function on_Equip(mouse)
	
	mouse.Button1Down:Connect(function()
		
		local remoteEvent = script.Parent.Remote;
		
		remoteEvent:FireServer(mouse.Hit.p)
	end)
end

tool.Equipped:Connect(on_Equip)

ServerScript:

local remoteEvent = script.Parent.Remote;

local function server_Event(player, mouseHit)
	
	local replicatedStorage = game:GetService("ReplicatedStorage")
	
	local rocket = replicatedStorage:FindFirstChild("Rocket")
	
	local rocketClone = rocket:Clone()
	
	rocketClone.Parent = workspace
	
	local handle = script.Parent.Handle
	
	rocketClone.Position = handle.CFrame.Position + handle.CFrame.LookVector * 2.3
	
	local distance = (mouseHit - handle.Position).Magnitude
	
	local tweenService = game:GetService("TweenService")
	
	local tweenInfo = TweenInfo.new(
		distance / 70,
		Enum.EasingStyle.Quad,
		Enum.EasingDirection.Out
	)
	
	local goals = {
		Position = mouseHit
	}
	
	local tween = tweenService:Create(rocketClone, tweenInfo, goals)
	
	tween:Play()
	
	wait(distance / 70)
	
	rocketClone:Destroy()
	
	local explosion = Instance.new("Explosion")
	
	explosion.Parent = workspace
	
	explosion.Position = mouseHit
end

remoteEvent.OnServerEvent:Connect(server_Event)

Note: This is an example of an RPG that I made not so long ago.

2 Likes

search up raycasting on google

4 Likes

Thanks but how would I know what are the parts and what should I name them?

1 Like

Place your rocket at ReplicatedStorage, and name it ‘Rocket’.And just add to the tool a RemoteEvent and name it ‘Remote’.

2 Likes

Yes, he could use Ray Casting to make a gun as well.

1 Like

Can you tell me what this rocket is :grin:
I’m not an expert in scripting

1 Like

Download it and move everything there into your game in the same way:
Rocket luncher…rbxl (37.4 KB)

2 Likes

Thanks this helped a lot :hugs:
Also I might join your team as a UI designer.

1 Like

I’m glad it helped. By the way, if you saw any scripts on ServerScriptService do not add them to your game. It’s a plugin that I used it was a weird virus, just do not add them. It’s called ‘studio_detection_by_azure’ something like this.

1 Like

You mean something like this -
virus.

1 Like

Yes. It’s a plugin that I used in the past, I realized it was a virus only a few days ago. Just don’t bother it and don’t add it to your game.

1 Like

Do you know what plugin it is? I have got them too and I don’t want them to keep appearing

1 Like

Sorry for the late respond, I don’t quite remember what plugin it was. But just try to disable each of your enabled plugins and wait until this doesn’t appear anymore, then you’ll know what plugin it is.