local UserInputService = game:GetService("UserInputService") local Player = game.Players.LocalPlayer local Character = Player.Character local Mouse = Player:GetMouse() local PunchCooldown = 0.5 local PunchReady = true Mouse.Button1Down:Connect(function() if PunchReady then Character.Punchleft:Play() end end)
I know the location of the player's character. I am using a custom character with all the proper r15 joints in place. i cant put my finger down as to why it's not working.
i don't really know what else of other information to put here. if you need some data from my game to try and fix this, i could edit this post.
The character hasn't loaded yet, one of the following codes provided would work.
local UserInputService = game:GetService("UserInputService") local Player = game.Players.LocalPlayer local Character = Player.Character local Mouse = Player:GetMouse() local PunchCooldown = 0.5 local PunchReady = true while not Character do wait() Character = Player.Character end Mouse.Button1Down:Connect(function() if PunchReady then Character.Punchleft:Play() end end)
OR this
local UserInputService = game:GetService("UserInputService") local Player = game.Players.LocalPlayer local Character = Player:WaitForChild("Character") local Mouse = Player:GetMouse() local PunchCooldown = 0.5 local PunchReady = true Mouse.Button1Down:Connect(function() if PunchReady then Character.Punchleft:Play() end end)