I need to get this script to fire an event but also create the event
I get the error: Infinite yield possible on ‘Players.Smixzol:WaitForChild(“Character”)’
I hava tried rewriting the code and playing with around with it still gives the same error all the time
local player = game.Players.LocalPlayer
if not player then
return
end
local Character = player:WaitForChild("Character")
if not Character then
return
end
print("foundplayer");
local playergetmouse = player:GetMouse();
if not player then
return
end
local HumanoidRootPart = player.Character:WaitForChild("HumanoidRootPart")
if not HumanoidRootPart then
return
end
print("Root part found");
local PunchEvent = Instance.new("RemoteEvent")
PunchEvent.Parent = player.Character;
if not PunchEvent then
return
end
print("puncheventadded");
print("script on");
coroutine.wrap(function()
while true do
if playergetmouse.Button1Down then
print("firing server");
Character.PunchEvent:FireServer()
print("fired server");
end
end
end)()