I have gotten everything working perfectly in this script however, I didn’t Realise putting it in a local script would make it so that the other player doesn’t really take damage but on my screen it does.
how can I create a normal script using this part of a local script with Remote events as it use UserInputService so i cannot just change it from local script to Server script easily.
UIS.InputBegan:Connect(function(input)
wait(0.01)
if input.KeyCode == Enum.KeyCode.E then
if PunchLanded == true then
if not CD then
CD = true
local Event = nil
local Hitbox = RS.GroundPunchHB:Clone()
Hitbox.CFrame = HRP.CFrame * CFrame.new(0,-3,0)
Hitbox.Parent = workspace
Event = Hitbox.Touched:Connect(function(hit)
local hum = hit.Parent:FindFirstChildOfClass("Humanoid")
if hum and hum.Parent.Name ~= Plr.Name then
if not Debounce then
Debounce = true
local Indicator = RS:WaitForChild("DmgIndicator")
if Indicator then
if PunchLanded == true then
wait(0.1)
local gui = Indicator:Clone()
gui.Parent = hit.Parent.HumanoidRootPart
gui.Shadow.Text = "-"..tostring(damage)
gui.Shadow.Damage.Text = "-"..tostring(damage)
gui.StudsOffset = Vector3.new(math.random(-2,2), math.random(-2,2), math.random(-2,2))
local TweenDamageGui = game:GetService("TweenService"):Create(gui, TweenInfo.new(1, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out, 0, false), {Size = UDim2.new(1.5, 0 , 1.5 , 0)})
TweenDamageGui:Play()
game.Debris:AddItem(gui, 1.5)
wait(0.1)
hum:TakeDamage(damage)
wait(0.3)
Debounce = false
end
end
end
end
end)
local weld = Instance.new("ManualWeld")
weld.Part0 = Hitbox
weld.Part1 = HRP
weld.C0 = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame)
weld.Parent = weld.Part0
wait(0.1)
Event = nil
Hitbox:Destroy()
wait(3)
CD = false
end
end
end
end)
Thanks to anyone that helps