i made this attack script for a gui buttom but it wont play the function...
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local punchEvent = ReplicatedStorage:WaitForChild("PunchEvent")
local Button = script.parent.MouseButton1Down
local button_clicked = true
-- Don't use MouseButton1Down. Think of your mobile and console players!
local connection
connection = script.Parent.Activated:Connect(function()
button_clicked = false
connection:Disconnect()
connection = nil
end)
local ready = true
local function punch(inputObject, gameProcessed)
if connection == true and ready then
print("uhhhh workin")
punchEvent:FireServer()
ready = false
wait(0.5)
ready = true
end
end
UserInputService.InputBegan:Connect(punch)
-----------------

1 comment
hey you actually can use MouseButtonDown because you can make separate functions for mobile and console players, such as for mobile you would use contextactionservice and for console you can add in the controller buttons.