#I need help
1 messages · Page 1 of 1 (latest)
wait
--SERVICES --
local UIS = game:GetService("UserInputService")
local RS = game:GetService("ReplicatedStorage")
local TS = game:GetService("TweenService")
-- BASIC VARIABLES --
local Player = game.Players.LocalPlayer
local Char
local HumRP
local Tool = script.Parent
-- VALUES --
local Equipped = script:WaitForChild("Equipped")
local Holding = script:WaitForChild("Holding")
local Using = script:WaitForChild("Using")
-- FOLDERS --
local Remotes = RS:WaitForChild("Remotes")
local Modules = RS:WaitForChild("Modules")
local anim1 = script:WaitForChild("AnimationCharge")
local anim2 = script:WaitForChild("AnimationRelease")
-- REMOTES --
local SkillsHandler = script.RemoteEvent
local sound = script:WaitForChild("Lava")
-- MOUSE --
local Mouse = Player:GetMouse()
local deb = false
-- FUNCTIONS --
Tool.Equipped:Connect(function()
-- PLAY IDLE
SkillsHandler:FireServer("Equip")
Char = Tool.Parent
HumRP = Char:WaitForChild("HumanoidRootPart")
end)
Tool.Unequipped:Connect(function()
-- STOP IDLE
SkillsHandler:FireServer("Unequip")
end)
UIS.InputBegan:Connect(function(Input, isTyping)
if isTyping then return end
if Input.KeyCode == Enum.KeyCode.Z and deb == false and Tool.Active.Value == "None" then
if Equipped.Value and Holding.Value == "None" and not Using.Value then
deb = true
SkillsHandler:FireServer("Hold", "Z")
script.ArmEvent:FireServer()
Tool.Active.Value = "Yes"
wait(9)
deb = false
end
end
end)
UIS.InputEnded:Connect(function(Input, isTyping)
if isTyping then return end
if Input.KeyCode == Enum.KeyCode.Z then
if Holding.Value == "Z" then
SkillsHandler:FireServer("Z", Mouse.Hit.Position)
spawn(function()
wait(2)
Tool.Active.Value = "None"
end)
script.ArmEventDown:FireServer()
local Track2 = Char.Humanoid:LoadAnimation(script.AnimationRelease)
Track2:Play()
Track1:Stop()
sound1:Destroy()
end
end
end)
Holding:GetPropertyChangedSignal("Value"):Connect(function()
if Holding.Value ~= "None" then
HumRP.Anchored = true
if Holding.Value == "Z" then
sound1 = sound:Clone()
sound1.Parent = Char["Right Arm"]
sound1:Play()
Track1 = Char.Humanoid:LoadAnimation(script.AnimationCharge)
Track1:Play()
repeat
HumRP.CFrame = CFrame.lookAt(HumRP.Position, Mouse.Hit.Position)
task.wait()
until Holding.Value ~= "Z"
end
else
HumRP.Anchored = false
end
end)
its one code
how
surround by 3 `
k
yea, do with the whole script now
--SERVICES --
local UIS = game:GetService("UserInputService")
local RS = game:GetService("ReplicatedStorage")
local TS = game:GetService("TweenService")
-- BASIC VARIABLES --
local Player = game.Players.LocalPlayer
local Char
local HumRP
local Tool = script.Parent
-- VALUES --
local Equipped = script:WaitForChild("Equipped")
local Holding = script:WaitForChild("Holding")
local Using = script:WaitForChild("Using")
-- FOLDERS --
local Remotes = RS:WaitForChild("Remotes")
local Modules = RS:WaitForChild("Modules")
local anim1 = script:WaitForChild("AnimationCharge")
local anim2 = script:WaitForChild("AnimationRelease")
-- REMOTES --
local SkillsHandler = script.RemoteEvent
local sound = script:WaitForChild("Lava")
-- MOUSE --
local Mouse = Player:GetMouse()
local deb = false
-- FUNCTIONS --
Tool.Equipped:Connect(function()
-- PLAY IDLE
SkillsHandler:FireServer("Equip")
Char = Tool.Parent
HumRP = Char:WaitForChild("HumanoidRootPart")
end)
Tool.Unequipped:Connect(function()
-- STOP IDLE
SkillsHandler:FireServer("Unequip")
end)
first part
if isTyping then return end
if Input.KeyCode == Enum.KeyCode.Z and deb == false and Tool.Active.Value == "None" then
if Equipped.Value and Holding.Value == "None" and not Using.Value then
deb = true
SkillsHandler:FireServer("Hold", "Z")
script.ArmEvent:FireServer()
Tool.Active.Value = "Yes"
wait(9)
deb = false
end
end
end)
UIS.InputEnded:Connect(function(Input, isTyping)
if isTyping then return end
if Input.KeyCode == Enum.KeyCode.Z then
if Holding.Value == "Z" then
SkillsHandler:FireServer("Z", Mouse.Hit.Position)
spawn(function()
wait(2)
Tool.Active.Value = "None"
end)
script.ArmEventDown:FireServer()
local Track2 = Char.Humanoid:LoadAnimation(script.AnimationRelease)
Track2:Play()
Track1:Stop()
sound1:Destroy()
end
end
end)
Holding:GetPropertyChangedSignal("Value"):Connect(function()
if Holding.Value ~= "None" then
HumRP.Anchored = true
if Holding.Value == "Z" then
sound1 = sound:Clone()
sound1.Parent = Char["Right Arm"]
sound1:Play()
Track1 = Char.Humanoid:LoadAnimation(script.AnimationCharge)
Track1:Play()
repeat
HumRP.CFrame = CFrame.lookAt(HumRP.Position, Mouse.Hit.Position)
task.wait()
until Holding.Value ~= "Z"
end
else
HumRP.Anchored = false
end
end)```
its one code
why are you firing the event in input ended function
i didnt write the code
bruh
change it so that it fires in inputbegan instead of inputended
I cant rlly help you if you dont know how to code
i know what u mean
alr
no
put the lua code tag so i dont read white text