Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My Game:Getservice(Chat) doesn't work.?

Asked by 10 years ago

local debounce = false

function getPlayer(humanoid) local players = game.Players:children() for i = 1, #players do if players[i].Character.Humanoid == humanoid then return players[i] end end return nil end

function onTouch(part)

local human = part.Parent:findFirstChild("Humanoid") if (human ~= nil) and debounce == false then game:GetService("Chat"):Chat(Player.Character.Head, "Kamui!") debounce = true

local player = getPlayer(human)

if (player == nil) then return end

script.Parent:clone().Parent = player.Backpack

wait(2) debounce = false end end

script.Parent.Parent.Touched:connect(onTouch)

1 answer

Log in to vote
1
Answered by 10 years ago

Player is not defined (Player.Character.Head). Maybe you want part.Parent.Head instead? Or even human.Parent.Head?

Ad

Answer this question