This is my script and i've tried looking this error up but there's no posts about it? I'm very confused
script.Parent.Touched:Connect(function(player)
player.PlayerGui.Info.TextLabel.Text = "find a way to break the wall."
end)
This is my script and i've tried looking this error up but there's no posts about it? I'm very confused
script.Parent.Touched:Connect(function(player)
player.PlayerGui.Info.TextLabel.Text = "find a way to break the wall."
end)
When something is touched, it returns the part that touched it, not the player who touched it. To find the player who touched it, I would recommend checking whether the part touched is a limb of a player and then use that to find the player instance.
Here's your edited code:
script.Parent.Touched:Connect(function(hit)
if hit.Parent and game:GetService("Players"):FindFirstChild(hit.Parent.Name) then
local player = game:GetService("Players"):FindFirstChild(hit.Parent.Name)
player.PlayerGui.Info.TextLabel.Text = "find a way to break the wall."
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.