Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

how do i make a script which kicks someone wearing a specific hat?

i want to know how to so i can expand on that and try different things

1 comment

0

Thats just so mean I like my hat.

2 answers

When they spawn check that they are wearing the offending hat (with character:WaitForChild(hatName, 3), including the 3s timeout) and if the result is not nil call kick on their player.

PS: Don't kick me because of my head :(

In a server script placed in StarterCharacterScripts write the folllowing.

local hat = "hat name"
if script.Parent:FindFirstChild(hat) then
	local plr = game.Players:GetPlayerFromCharacter(script.Parent)
	plr:Kick("You were kicked for wearing ".. hat)
end


If the player is not wearing the hat it will say it cant find it.

3 comments

0

He said kicks someone, not destroys the hat.

0

Oh sorry

0

Fixed

This discussion is preserved as it was. New answers, comments, and votes are closed.