0% found this document useful (0 votes)
14 views1 page

code

The document contains Lua scripts for a combat system in a game, utilizing user input to trigger combat actions. It includes a debounce mechanism to prevent multiple activations of the combat skill when the 'E' key is pressed. The scripts also handle server events to manage combat interactions between players and the game server.

Uploaded by

iamhimlife448
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views1 page

code

The document contains Lua scripts for a combat system in a game, utilizing user input to trigger combat actions. It includes a debounce mechanism to prevent multiple activations of the combat skill when the 'E' key is pressed. The scripts also handle server events to manage combat interactions between players and the game server.

Uploaded by

iamhimlife448
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Combat:

local plr = game.Player.LocalPlayer

local UIS = game :GetService("UserInputServer")

local debounce = false


UIS.InputBegan:Connect(Function(Input, IS)
if IS = true then return end

if Input.KeyCode = Enum.KeyCode.E then


if debounce = true then return end
debounce = true
print ("E key is pressed")
wait (5)
debounce = false
end
end)

CombatSkill:
local plr = game.Player.LocalPlayer

local UIS = game :GetService("UserInputServer")

local debounce = false


UIS.InputBegan:Connect(Function(Input, IS)
if IS == true then return end

if Input.KeyCode == Enum.KeyCode.E then


if debounce == true then return end
debounce = true
game.ReplicatedStorage.CombatHit:FireServer()
print ("E key is pressed")
wait (5)
debounce = false
end
end)

CombatServer:
game.ReplicatedStorage.CombatHit.OnServerEvent.Connect(Function(plr))
print (plr)
end)

You might also like