Hey, I’ve been making this script for a tooltip I’m making, and for some reason, the images that I’m loading in aren’t showing up. I’m not getting any errors, and to my knowledge, all the variables and whatnot are rooted correctly. So I don’t know why this is happening. If anyone can help, please do. Thanks a lot in advance.
Code
local vpf = script.Parent.Highlight.ViewportFrame
local highlight = Instance.new("MeshPart", vpf)
local tooltip = script.Parent.Tooltip
local data = game.ReplicatedStorage:WaitForChild("ObjectInformation")
local rs = game:GetService("RunService")
local hovering = script.Hovering.Value
local target
highlight.BrickColor = BrickColor.new("New Yeller")
highlight.Transparency = 1
vpf.CurrentCamera = workspace.Camera
local function funcHighlight(t)
highlight.Position = Vector3.new(t.Position.X,t.Position.Y,t.Position.Z)
highlight.MeshId = t.MeshId
highlight.Transparency = 0
end
event.OnClientEvent:Connect(function(obj,hover,holding)
if hover == true then
tooltip.Visible = true
hovering = true
target = obj
if obj:FindFirstChild("InfoType") then
if obj.InfoType.Value == 1 then
tooltip.Title.Visible = true
tooltip.Thumbnail.Visible = true
tooltip.Thumbnail.Image = "rbxassetid://"..data[obj.Name].ImageID.Value
else
if obj.InfoType.Value == 2 then
tooltip.Title.Visible = true
tooltip.InfoSmall.Visible = true
tooltip.Thumbnail.Visible = true
tooltip.Thumbnail.Image = "rbxassetid://"..data[obj.Name].ImageID.Value
else
if obj.InfoType.Value == 3 then
tooltip.Title.Visible = true
tooltip.Body.Visible = true
tooltip.Thumbnail.Visible = true
tooltip.Thumbnail.Image = "rbxassetid://"..data[obj.Name].ImageID.Value
else
if obj.InfoType.Value == 4 then
tooltip.Title.Visible = true
tooltip.InfoLeft.Visible = true
tooltip.InfoRight.Visible = true
tooltip.Thumbnail.Visible = true
tooltip.Thumbnail.Image = "rbxassetid://"..data[obj.Name].ImageID.Value
else
if obj.InfoType.Value == 5 then
tooltip.Title.Visible = true
tooltip.Info1.Visible = true
tooltip.Info2.Visible = true
tooltip.Info3.Visible = true
else
if obj.InfoType.Value == 6 then
tooltip.Title.Visible = true
tooltip.Contents.Visible = true
for i,v in pairs(obj.Contents:GetChildren()) do
local content = Instance.new("Frame",tooltip.Contents)
local text = Instance.new("TextLabel",content)
local image = Instance.new("ImageLabel",content)
content.BackgroundColor3 = Color3.fromRGB(135,135,135)
content.Size = UDim2.new(.9 ,0,.25,0)
content.BorderColor3 = Color3.fromRGB(11,121,9)
content.BorderMode = "Middle"
content.BorderSizePixel = 5
content.Name = "SubContent"
content.ZIndex = 2
text.Text = (v.Name.." - "..v.Measurement.Value..v.Abbreviation.Value)
text.TextScaled = true
text.TextXAlignment = "Right"
text.Size = UDim2.new(.8,0,0,50)
text.Position = UDim2.new(.1,0,0,0)
image.Name = "SubThumbnail"
image.Image = "rbxassetid://"..data[v.Name].ImageID.Value
image.Size = UDim2.new(.2,0,0,50)
image.ScaleType = "Fit"
end
end
end
end
end
end
end
end
else
tooltip.Visible = false
hovering = false
target = nil
for i,v in pairs(tooltip:GetDescendants()) do
if v.ClassName == "TextLabel" or v.ClassName == "Frame" then
v.Visible = false
end
end
for i,v in pairs(tooltip.Contents:GetChildren()) do
if v.ClassName == "Frame" and v.Name == "SubContent" then
v:Destroy()
end
end
end
end)
rs.Heartbeat:Connect(function()
if hovering == true then
tooltip.Position = UDim2.new(0,workspace.CurrentCamera:WorldToViewportPoint(target.Position).X,0,workspace.CurrentCamera:WorldToViewportPoint(target.Position).Y)
end
end)
As usual, if this is a duplicate of another post, please refer me to it. You guys rock.