i made a punch script with remote events and it doesn't work it the real game
The local Script in Starter Gui
local remote = Instance.new("RemoteEvent",game.Workspace) remote.Name = "PunchEvent" local use = false local uis = game:GetService("UserInputService") local play = game.Players.LocalPlayer local char = play.Character or play.CharacterAdded:wait() local humanoid = char.Humanoid uis.InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.E and use == false then use = true local punch = humanoid:LoadAnimation(script.Animation) remote:FireServer() punch:Play() wait(1) use = false end end)
The Normal Script in Workspace...
local punche = game.Workspace:WaitForChild("PunchEvent") punche.OnServerEvent:Connect(function(player, use) local char = player.Character or player.CharacterAdded:wait() local hum = char.Humanoid local rightp = char:WaitForChild("RightHand") local hitall = false rightp.Touched:Connect(function(hit) if hit and hit.Parent:FindFirstChild("Humanoid") and hitall == false then hitall = true hit.Parent.Humanoid:TakeDamage(15) end end) end)
Did I get Something mixed up?