I have a dialogue script, however, for some reason when I move far from the touch part, For example, around 500 studs,
there is an error that says that the part does not exist even though it already is there, I have no idea how to fix it. But it does not seem to interfere with the script that much, it is very annoying to see a lot of errors in the output log, the script is listed below
local touchpart = workspace["Floor 7"] :WaitForChild("touchpart16")
local player = game.Players.LocalPlayer
local text = player.PlayerGui.Dialogue["Floor 7"].Text1.TextLabel
local canhit = true
touchpart.Touched:Connect(function(hit)
if canhit == true then
local name = hit.Parent.Name
if hit and hit.Parent:FindFirstChild("Humanoid") then
text.Visible = true
for i,p in pairs(game.Players:GetChildren()) do
if p.Name == name then
canhit = false
text.Visible = true
wait(2)
text.Visible = false
wait(900000000000000)
canhit = true
elseif p.Name ~= name then
text.Visible = false
break
end
end
end
end
end)
THE ERROR
touchpart16 is not a member of Floor 7