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

Uncertain of the error here? (UNSOLVED)

I've tried running this through output and stuff, and it's not helpful to me. I'm having troubles getting a model to clone from server storage after a player steps on a brick that was created in Workspace through Instance.new. The script is: In a local script > Inside of a button > Inside of a Frame > Inside a GUI

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

 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 = game.ServerStorage.Sofa:Clone()
clone.Parent = workspace
clone:MoveTo(Vector3.new(3.301, 0.7, 36.088)) --Models don't have position. To move a model use :MoveTo(Vector3.new())
wait(.2)
player.Character.Torso.Anchored = false
end
tutorial.Touched:connect(onTouched)

3 answers

Try changing the variable "clone" to something like "pie" and try using game.workspace in replace of workspace in line 29.

Also I like to use game.lighting when it comes to storage places. I remember using ServerStorage once and it didt work.

I might be wrong, but this is my best answer.

1 comment

0

I had lighting before. It made no effect. Also, I see what you mean about the variable mix up, since i later in the same line use :Clone(). Thanks, I haven't noticed that!

You cannot access ServerStorage from a LocalScript, for the purpose of ServerStorage is to prevent objects from replicating to the client.

If you want to use a storage( don't use Lighting, strongly unadvised ), use ReplicatedStorage. It's meant to replicate, and was made as a replacement for Lighting, which was used improperly. Just move the object in Studio, and change the code from local clone = game.ServerStorage.Sofa:Clone() to local clone = Game.ReplicatedStorage.Sofa:Clone().

1 comment

0

Okay thanks. I was previously told that I should use ServerStorage. I'll try it though! :-)

try this

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

 tutorial = Instance.new("Part")

tutorial.Parent = game.Workspace

tutorial.Name = "tutorial"

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

    local g = Instance.new("Hint",player.PlayerGui)
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',player.PlayerGui)
player.Character.Torso.Anchored = true
a.Text = "Tutorial Loading."
wait(.5)
a.Text = "Tutorial Loading.."
wait(.5)
a.Text = "Tutorial Loading..."
local clone = game.ServerStorage.Sofa:Clone()
clone.Parent = game.Workspace
clone:MoveTo(Vector3.new(3.301, 0.7, 36.088)) --Models don't have position. To move a model use :MoveTo(Vector3.new())
wait(.2)
player.Character.Torso.Anchored = false
end
tutorial.Touched:connect(onTouched)

if it doesn't work tell me C:

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