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

Uncertain of the error here? (UNSOLVED)

Asked by 9 years ago

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

Log in to vote
0
Answered by
Dr_Doge 100
9 years ago

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.

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! SmokeyIsSmoking 0 — 9y
Ad
Log in to vote
0
Answered by
Diitto 230 Moderation Voter
9 years ago

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().

0
Okay thanks. I was previously told that I should use ServerStorage. I'll try it though! :-) SmokeyIsSmoking 0 — 9y
Log in to vote
0
Answered by 9 years ago

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:

Answer this question