I want to make gun system like zombie attack

now i working on zombie game and i want a good gun system for its. but i am new and i don’t know much of raycasting and device support. the reason that i want a gun system like because it’s really easy to use for pc and mobile. in mobile i like how it’s have aim button that set a raycast position to center like shift lock position and shoot position that work well. if you wanna know how good just try it. Disclaimer: I didn’t want to copied or steal a game but a want only some system it’s useful because i want a game that work in any device that is the most important thing for me thx :D.

4 Likes

if u don’t mind can any one make a video about it. i want to learn :sweat_smile:

You can’t ask people to make entire systems for you. Instead, hire somebody at https://talent.roblox.com.

1 Like

This would be suitable more in #help-and-feedback than in #development-discussion.

You’ll need to know Raycasting and OOP(Object orientated programming). As stated by @bluebxrrybot, you will need to hire someone if your asking us to make an entire gun system.

now i have a raycast already


> -- Constants
local tool = script.Parent
local COOLDOWN = tool:GetAttribute("Cooldown")
local RANGE = tool:GetAttribute("Range")
local DAMAGE = tool:GetAttribute("Damage")
-- Variables
local origin = tool:WaitForChild("Origin")
local handle = tool:WaitForChild("Handle")
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local gunEvent = script.Parent.GunEvent
local equipped = false
local mouseDown = false

-- Sounds
local Sound = {
	Fire = handle:WaitForChild("GunFire"),
	Equip = handle:WaitForChild("GunEquip"),
	UnEquip = handle:WaitForChild("GunUnEquip")
}

-- Equipping and unequipping
tool.Equipped:Connect(function()
	Sound.Equip:Play()
	equipped = true
end)

tool.Unequipped:Connect(function()
	Sound.UnEquip:Play()
	equipped = false
end)

-- Fire gun function
local function FireGun()
	local originPos = origin.Position
	local mousePos = mouse.Hit.Position
	Sound.Fire:Play()
	gunEvent:FireServer(originPos, mousePos, RANGE, DAMAGE)
	wait(COOLDOWN)
end

-- Input handling
mouse.Button1Down:Connect(function()
	if equipped then
		mouseDown = true
		while mouseDown do
			FireGun()
		end
	end
end)

mouse.Button1Up:Connect(function()
	mouseDown = false
end)
e

next is a mobile support/mobile input like zombie attackstyle what should i do with this localscript. help me pls

I’m sorry but I don’t see epanyhthing to do with ray casting. I think that needs to be done on the server.

Zombie attack has one of the easier gun systems. There is a good tutorial by B Ricey