Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to Make an Automatic Gun Using ROBLOX's RayCasting Script?

Asked by 6 years ago
Edited 6 years ago

Guys, I am so sorry... this is such a simple question but I do not know. I think it has something to do with loops. I am not sure. I am using ROBLOX's RayCasting Script. I don't need a super long answer or anything, just something to point me in the right direction. Thank you! -TheFierceWaffle

1 answer

Log in to vote
0
Answered by 6 years ago

Well you can just do Button1Down etc like so

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

local mouseDown = false
local canPlay = true

mouse.Button1Down:Connect(function()
    mouseDown = true
end)

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

while true do

    if mouseDown then
        if canPlay then
            canPlay = false
            --Put your code stuff here
            canPlay = true
        end
    end
end

Hope it helped :D If it helped please mark it as answered

0
no wait EliteMackan 0 — 5y
0
what? DumbKickButt5588 167 — 5y
Ad

Answer this question