How can you properly stun a player?

Hi, I am attempting to make a part where if you touch it you get stunned to the ground, this is what I attempted already:

script.Parent.Touched:Connect(function(hit)

			for i,v in pairs(game.Workspace:GetChildren()) do
			if v:IsA("BasePart") and v.Name == "HumanoidRootPart" then
				v:Destroy()
				end
			end
		
		end	
end)

Any assistance is appreciated.

The PlatformStand property of Humanoids allow them to have what could be considered a stun effect.

4 Likes

(Reply deleted by author,already posted reply/problem solved/temporary message)

Try this instead:

script.Parent.Touched:Connect(function(partThatTouched)
    local Player =  game.Players:GetPlayerFromCharacter(partThatTouched) 
 
    if Player then
    Player.Character.HumanoidRootPart:Destroy()
    end
end)

Pretty sure this would kill the player though, not make them fall to the ground.

1 Like

Destroying the HumanoidRootPart makes the player unable to walk or move their character in the slightest bit. Impossible for it to kill the player.

script.Parent.Touched:Connect(function(hit)
    local Player =  game.Players:GetPlayerFromCharacter(hit) 
 
    if Player then
    Player.Character.Humanoid.PlatformStand = true
    end
end)

I don’t think that will work, try setting their humanoid’s PlatformStand property to true, like @phoenixressusection just said

1 Like

this would cause a bunch of errors to appear (wont break though)

Who came with this idea of "“HumanoidRootPart:Destroy()”, was not him, he just tried to help.