I have 2 scripts that work in studio but not in the real game. Why is this? And can someone fix them so they work in game?
script.Parent.MouseButton1Down:connect(function()
if script.Parent.Parent.Parent.Value.Value == 0 then
local g = Instance.new("BillboardGui")
g.Parent = script.Parent.Parent.Parent.Parent.Parent.Character.Head
g.Size = UDim2.new(4,0,2,0)
g.Name = "Q"
local t = Instance.new("TextBox")
t.Parent = script.Parent.Parent.Parent.Parent.Parent.Character.Head.Q
t.Text = "Question"
t.BackgroundTransparency = 1
t.TextColor3 = Color3.new(0/255, 170/255, 0/255)
t.FontSize = "Size12"
t.Size = UDim2.new(1,0,1,0)
g.StudsOffset = Vector3.new(0, 3, 0)
script.Parent.Parent.Parent.Value.Value = 1
else
script.Parent.Parent.Parent.Value.Value = 0
script.Parent.Parent.Parent.Parent.Parent.Character.Head.Q.TextBox:Remove()
script.Parent.Parent.Parent.Parent.Parent.Character.Head.Q:Remove()
end
end)
script.Parent.MouseButton1Down:connect(function() script.Parent.Parent.Parent.Parent.Parent.Character.Torso:Destroy() end)

1 comment
I cant help right now but most "Works in studio etc." questions have an issue involving a localscript. A tip.