Hey, I have a punching script and it is only registering once. i will send the scripts in the replies also this is NOT solved, I accidently clicked Solved
Local Script :
–Punch Local–
local rep = game:GetService(“ReplicatedStorage”)
local player = game.Players.LocalPlayer
local event = rep:WaitForChild(“PunchEvent”):WaitForChild(“RemoteEvent”)
print(“He.lloodoodd”)
script.Parent.Activated:Connect(function()
print(“Hello?”)
event:FireServer()
end)
game:GetService(“ReplicatedStorage”).PunchEvent.SendSound.OnClientEvent:Connect(function()
game:GetService(“SoundService”).PunchWoosh:Play()
local random = math.random(1,900)
local newXPOS = random/1000
local clone = game:GetService(‘ReplicatedStorage’).PopUp:Clone()
clone.Parent = player.PlayerGui:WaitForChild(“PopUps”)
clone.Position = UDim2.new(newXPOS, 0, 1, 0)
clone.Text = “+”…“1”…“”
game:GetService(“Debris”):AddItem(clone, 0.65)
end)
Server Script:
–Punch Server Script–
local chosen = true
local debounce = true
game:GetService(“ReplicatedStorage”).PunchEvent.RemoteEvent.OnServerEvent:Connect(function(player)
local char = player.Character
local rightPunch = script:WaitForChild(“Right Punch”, 1)
local leftPunch = script:WaitForChild(“Left Punch”, 1)
local humanoid = char:FindFirstChild(“Humanoid”)
local rightLoaded = humanoid:LoadAnimation(rightPunch)
local leftLoaded = humanoid:LoadAnimation(leftPunch)
if debounce then
if chosen then
chosen = false
debounce = false
print("You Workin?")
rightLoaded:Play()
game:GetService("ReplicatedStorage").PunchEvent.SendSound:FireClient(player)
player.leaderstats.Strength.Value += 1
rightLoaded.Stopped:Connect(function()
wait(0.4)
debounce = true
end)
else
leftLoaded:Play()
game:GetService("ReplicatedStorage").PunchEvent.SendSound:FireClient(player)
player.leaderstats.Strength.Value += 1
print("You Workin? ddddd")
chosen = true
debounce = false
leftLoaded.Stopped:Connect(function()
wait(0.4)
debounce = true
end)
end
end
end)
Ello! Can you officially format the code? Using three back quotes
local rep = game:GetService("ReplicatedStorage")
local player = game.Players.LocalPlayer
local event = rep:WaitForChild("PunchEvent"):WaitForChild("RemoteEvent")
print("He.lloodoodd")
script.Parent.Activated:Connect(function()
print("Hello?")
event:FireServer()
end)
game:GetService("ReplicatedStorage").PunchEvent.SendSound.OnClientEvent:Connect(function()
game:GetService("SoundService").PunchWoosh:Play()
local random = math.random(1,900)
local newXPOS = random/1000
local clone = game:GetService('ReplicatedStorage').PopUp:Clone()
clone.Parent = player.PlayerGui:WaitForChild("PopUps")
clone.Position = UDim2.new(newXPOS, 0, 1, 0)
clone.Text = "+".."1".."🥊"
game:GetService("Debris"):AddItem(clone, 0.65)
end)
local chosen = true
local debounce = true
game:GetService("ReplicatedStorage").PunchEvent.RemoteEvent.OnServerEvent:Connect(function(player)
local char = player.Character
local rightPunch = script:WaitForChild("Right Punch", 1)
local leftPunch = script:WaitForChild("Left Punch", 1)
local humanoid = char:FindFirstChild("Humanoid")
local rightLoaded = humanoid:LoadAnimation(rightPunch)
local leftLoaded = humanoid:LoadAnimation(leftPunch)
if debounce then
if chosen then
chosen = false
debounce = false
print("You Workin?")
rightLoaded:Play()
game:GetService("ReplicatedStorage").PunchEvent.SendSound:FireClient(player)
player.leaderstats.Strength.Value += 1
rightLoaded.Stopped:Connect(function()
wait(0.4)
debounce = true
end)
else
leftLoaded:Play()
game:GetService("ReplicatedStorage").PunchEvent.SendSound:FireClient(player)
player.leaderstats.Strength.Value += 1
print("You Workin? ddddd")
chosen = true
debounce = false
leftLoaded.Stopped:Connect(function()
wait(0.4)
debounce = true
end)
end
end
end)