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

What is the problem here?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

I've attempted to fix and further this script numerous times, and it's just not working out for me. Here's what is supposed to come out of it: A user clicks the gui button, the gui closes, and creates a part into workspace. A hint "message" appears at the top. When a player touches the part that the gui button created, an object from lighting clones into workspace and positions in a spot. the player (who is already anchored at the torso) is unanchored (after clicking the button)

What I have working: A user clicks the gui button, the gui closes [done] creates a part into workspace [done]

What isn't working A hint "message" appears at the top [not done] Player torso is unanchored [not done] When a player touches the part that the gui button created, an object from lighting clones into workspace and positions in a spot [not done]


local player = game.onPlayerAdded
script.Parent.MouseButton1Down:connect(function()
                             script.Parent.Parent.Visible = false
            Instance.new("Part",workspace).Name = "tutorial"

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

    local g = Instance.new("Hint", workspace)
g.Text = player.Name..", Step on the gray square behind you to begin tutorial!"

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

end)
function onTouched(part)
local clone = Lighting.Sofa:Clone()
clone.Parent = workspace
    clone.Name = sofa1
Position.sofa1 = Vector3.new(3.301, 0.7, 36.088)
end
0
And yes, this is in a LocalScript. SmokeyIsSmoking 0 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.
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)
g.Text = player.Name..", Step on the gray square behind you to begin tutorial!"

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

end)
function onTouched(part)
local clone = Lighting.Sofa:Clone()
clone.Parent = workspace
    clone.Name = sofa1
clone:MoveTo(Vector3.new(3.301, 0.7, 36.088)) --Models don't have position. To move a model use :MoveTo(Vector3.new())
end
end)

Variables don't change even if the name of what the variable is representing changed. More on Variables.

0
Actually, you can get the exact Position of a 'Model' type instance by using the 'GetModelCFrame' method [Model:GetModelCFrame().p], and you can also set it's Position. TheeDeathCaster 2368 — 9y
0
@Alpha Thanks! I never knew that. EzraNehemiah_TF2 3552 — 9y
Ad

Answer this question