I am writing some code to display a ScreenGui
when I hover over a specific model:
local function checkHoverForSurvivor()
local target = mouse.Target
if not target then return end
local currentParent = target.Parent
while currentParent do
if currentParent:IsA("Model") and currentParent:HasTag("Survivor") then
local id: StringValue = currentParent:FindFirstChild("ID")
if not id then continue end
updateSurvivorDisplay(id.Value)
survivorDisplay.Enabled = true
return
end
currentParent = currentParent.Parent
end
survivorDisplay.Enabled = false
end
RunService.RenderStepped:Connect(checkHoverForSurvivor)
It gives the script timeout error on this line: local id: StringValue = currentParent:FindFirstChild("ID").
The weird part is that it only gives this error (and crashes my Roblox Studio) when I place the Survivor
tag on a model. Why would that cause this error? It works completely fine otherwise.