SO what this script does is that you touch a part of a Model, it destroys the part with the touch function after making it invisible, and then makes the model the model is in visible, but it only works in studios. Any help?
function onTouch(hit)
script.Parent.Sound:Play()
script.Parent.Main.Transparency = 1
script.Parent.Main.CanCollide = false
script.Parent.Part.Transparency = 1
script.Parent.Part.CanCollide = false
script.Parent.Coil.Transparency = 1
script.Parent.Coil.CanCollide = false
script.Parent.Parent.Coil.Transparency = 0
script.Parent.Parent.Main.Transparency = 0
script.Parent.Parent.Part.Transparency = 0.5
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
if game.Players:FindFirstChild(hit.Parent.Name) ~= nil then
local player = game.Players:FindFirstChild(hit.Parent.Name)
if player:FindFirstChild("PlayerGui"):FindFirstChild("ScreenGui") == nil then
sg = Instance.new("ScreenGui")
sg.Parent = player:FindFirstChild("PlayerGui")
end
if player.PlayerGui.ScreenGui:FindFirstChild("MessageBox") == nil then
local f = Instance.new("Frame")
f.Name = "MessageBox"
f.Position = UDim2.new(0.4, 0, 0.1, 0)
f.Size = UDim2.new(0.4, 0, 0, 50)
f.Style = "RobloxSquare"
f.Parent = player.PlayerGui:FindFirstChild("ScreenGui")
local m = Instance.new("TextLabel")
m.Position = UDim2.new(0.5, 0, 0.5, 0)
m.FontSize = "Size14"
m.TextColor3 = Color3.new(1,1,1)
script.Parent.Main:Destroy()
------------------------------------------
m.Text = "You found a fuse... the night goes on."
wait(9)
------------------------------------------
f:Destroy()
end
end
end
end
script.Parent.Main.Touched:connect(onTouch)
2
