Hi! I'm Theamazingnater, and I'm having a bit of trouble. Obviously, that's why I'm here. I'm trying to make a 3D platformer, and I have this ground-pound code. But, it fires out of nowhere, even if I don't call it. It never happens in Studio, only a live game. The code below is in a LocalScript. For some reason, it's prone to happen while jumping.
EDIT: Just realized that I'm a dummy. The "or" was causing the bug.
if input.KeyCode == CrouchControl and canGP.Value == true and LongJumping ~= true and GroundPounding ~= true and Diving ~= true and canGroundPound ~= false and WallJumping ~= true and Swimming.Value ~= true and doublejump ~= true and state == Enum.HumanoidStateType.Freefall or state == Enum.HumanoidStateType.Jumping then
char:WaitForChild("Animate").Disabled = true
char.Humanoid.WalkSpeed = 0
GroundPounding = true
canGroundPound = false
hitfloor = false
Crouching = false
PlayAnimation("GroundpoundS")
rootpart:WaitForChild("Jumping").Pitch = 1.5
rootpart:WaitForChild("Jumping"):Play()
local vel = Instance.new("BodyVelocity",char.Torso)
vel.Velocity = Vector3.new(0,0,0)
vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
wait(1)
plrTrail.Enabled = true;
PlayAnimation("GroundPound")
game.ReplicatedStorage.BoolChange:FireServer(plr)
vel.Velocity = char.HumanoidRootPart.CFrame.upVector * -85
repeat wait() until hitfloor == true
plrTrail.Enabled = false;
boolValue.Value = true
vel:Destroy()
hitfloor = false
GroundPounding = false
char:WaitForChild("Animate").Disabled = false
char.Humanoid.WalkSpeed = 25
wait(0.1)
game.ReplicatedStorage.BoolChange2:FireServer(plr)
end
I've looked everywhere online and I found something, but it uses ContextActionService and not UserInputService. Any help would be appreciated! (Excuse the bad coding I tried fixing it on multiple occasions but nothing worked)
