Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I still have this unsolved script!!?

I'm having troubles cloning the object from lighting, and moving it to workspace, and positioning it.

The problem is every line after I have the second function function onTouched(part)

local player = game.Players.LocalPlayer --You are using a local script so you can use LocalPlayer.

script.Parent.MouseButton1Down:connect(function()

                             script.Parent.Parent.Visible = false

local tutorial = Instance.new("Part",workspace)

tutorial.Name = "tutorial"

tutorial.CFrame = CFrame.new(Vector3.new(3.301, 0.7, 36.088))

    local g = Instance.new("Hint", workspace)
wait(.3)
g.Text = player.Name..", Step on the gray square to begin tutorial!"
tutorial.Anchored = true
    wait(.3)
player.Character.Torso.Anchored = false        
end)
function onTouched(part)
local a = Instance.new('Message', workspace)
player.Character.Torso.Anchored = true
a.Text = "Tutorial Loading."
wait(.5)
a.Text = "Tutorial Loading.."
wait(.5)
a.Text = "Tutorial Loading..."
local clone = Lighting.Sofa:Clone()
clone.Parent = workspace
    clone.Name = sofa1
sofa1:MoveTo(Vector3.new(3.301, 0.7, 36.088)) --Models don't have position. To move a model use :MoveTo(Vector3.new())
end
wait()
a:Destroy()
local y = Instance.new('Message', workspace)
y.Text = "Tutorial Loaded!"
wait(1)
y:Destroy()
wait(.2)
player.Character.Torso.Anchored = false
tutorial.Touched:connect(onTouched) -- This is how I see this way of making a function usually lain out. Now, maybe having this at 23 will still work, I'm not sure; you can test.


1 answer

✓ Accepted answer

You haven't declared 'sofa1' and the clone.Name property has to be a String

Additionally, you must say game.Lighting and not just Lighting as you did on Line 28

Also, if you're planning to use tutorial.Touched:connect(onTouched), you can't have tutorial set to local, as it won't reach the scope of the other function.

IF YOURE STORING ITEMS, USE SERVERSTORAGE, NOT LIGHTING.

This discussion is preserved as it was. New answers, comments, and votes are closed.