Город МОСКОВСКИЙ
00:07:44

How to Make A Simple Gun In Roblox Studio [2020]

Аватар
Игровые Лидеры и Рекордсмены
Просмотры:
28
Дата загрузки:
30.10.2023 01:14
Длительность:
00:07:44
Категория:
Видеоигры

Описание

Today I will be making a simple gun in roblox studio. It is a beginner gun and not very difficult to make.
[Model]
https://www.roblox.com/library/5360074038/Simple-Gun-Model

[Scripts]

--In Tool--

-LocalScript-
local Tool = script.Parent

function on()
script.Parent.FireScript.Disabled = false
end
function off()
script.Parent.FireScript.Disabled = true
end


Tool.Equipped:connect(on)
Tool.Unequipped:connect(off)

-FireScript
local mouse=game.Players.LocalPlayer:GetMouse()
local fire = script.Parent:WaitForChild('fire')

mouse.Button1Down:connect(function(key)

fire:FireServer()

end)

-Script
local fire = script.Parent:WaitForChild('fire')

fire.OnServerEvent:Connect(function(player)

script.Parent.Lazer.Transparency = 0
local clone = game.ReplicatedStorage.Part:Clone()
clone.Parent = workspace
clone.Position = script.Parent.Part.Position
clone.Orientation = script.Parent.Handle.Orientation

wait(0.1)
script.Parent.Lazer.Transparency = 1

end)

--[In Part]--

-Health
local part = script.Parent

script.Parent.Touched:connect(function(hit)
if hit ~= nil then
local char = hit.Parent
if char ~= nil then
local humanoid = char:FindFirstChild("Humanoid")
if humanoid ~= nil then
humanoid.Health = humanoid.Health - 1
end
end
end
end)

-Script
local part = script.Parent




if part.Parent == workspace
then
wait(2)
part:Destroy()
--script.Parent.Archivable = false
end

Hope you enjoyed the video!

Рекомендуемые видео