To refer to a name with a space, we use square brackets ([ and ]) to index instead of a dot (.), and then the string of the name:
person["Name With Space"]
person.NameWithoutSpace
The part that touches us can be a leg or an arm or the head or torso. Those parts make up what a player's Character. Once we get the Character, we can grab the corresponding Player.
local D = Workspace.D
function onTouch(part)
game.Workspace.Player1.Head:Destroy()
character = part.Character
if character then
player = game.Players:GetPlayerFromCharacter( character )
if player then
character.Head:Destroy()
end
end
end
D.Touched:connect(onTouch)
1 comment
Thanks your makes more sense for me cause I am very new to scripting.