Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

How do I fix this? (FUNCTIONS)

Asked by 9 years ago

So this script was designed to function when the gui button is clicked (working) The player's torso is anchored until the player clicks the button (working) After the player clicks the gui button, a part is created, and positioned (working) When the player steps on the part created, a part is supposed to clone into the workspace, supposed to be anchored, and positioned (NOT WORKING)

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 behind you to begin tutorial!"

    wait()
player.Character.Torso.Anchored = false        

end)
function onTouched(part)
tutorial.OnTouched:connect(part)
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

The thing is everything works up until the object from lighting is supposed to be cloned. I think the problem is on line 23 tutorial.OnTouched:connect(part)

I don't know how to fix it, I want the parts to clone from workspace when that part is touched.

Answer this question