local player = game.Players.LocalPlayer
local playerName = player.Name
local head = workspace.Dummy.Head
part.TouchEnded:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
ChatService:Chat(head, "Hi devforum you like Bloxy Cola " .. playerName .. "?", "Red")
end
end)
Guessing by the script, are you trying to make the part say something when you stop touching it? Because I’m kinda confused on what you’re trying to say.
You can’t use game.Players.LocalPlayer on the server. Also, next time it would help if you explained what you’re problem is, and what you’re trying to do, so people can help you.
local head = workspace.Dummy.Head
part.TouchEnded:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
ChatService:Chat(head, `{player.Name}, you like Bloxy Cola?`, "Red")
end
end)