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

ToyotaChaser not a valid member of ServerStorage?

Asked by 5 years ago

Hello, I am trying to make a car spawner gui for my testing game. Here's the code.

script.Parent.MouseButton1Click:connect(function(GetCar)
        local Mod = game.ServerStorage.ToyotaChaser     --Change test to whatever you have named the item you want to spawn
        local clone = Mod:clone()
        clone.Parent = workspace
        clone:MakeJoints()
end)

But it gives me an error, and says ToyotaChaser is not a valid member of ServerStorage, even though there's a model named ToyotaChaser in ServerStorage.

0
I'm assuming you're using a local script, and if so, local scripts can't access ServerStorage. Also, you're cloning the vehicle on the client, so only you will see it and the vehicle might not work properly. You can get around this by using remote events : https://developer.roblox.com/articles/Remote-Functions-and-Events User#20279 0 — 5y

3 answers

Log in to vote
0
Answered by 5 years ago

reading the simple script what you did wrong is store the car in ServerStorage! when instances are placed in the ServerStorage it will store everything in the server not the client! to fix this make sure that your connect is spelt with a capital! change your Mod variable to

local Mod = game.ReplicatedStorage.ToyotaChaser

as well make sure the model is in the ReplicatedStorage!

script:

script.Parent.MouseButton1Click:Connect(function(GetCar)
            local Mod = game.ReplicatedStorage.ToyotaChaser     --Change test to whatever you have named the item you want to spawn
            local clone = Mod:clone()
            clone.Parent = workspace
            clone:MakeJoints()
    end)

im pretty sure that will work! your welcome. :)

Ad
Log in to vote
0
Answered by 5 years ago

Before all of this, I'm assuming this is a local script, MouseButton1Click does not pass an argument, :connect is deprecated, use :Connect, since this is a local script, it can only access client sided stuff, but ServerStorage is server sided, so it doesn't exist in this script, put the ToyotaChaser in game.ReplicatedStorage and locate Mod like this: local Mod = game.ReplicatedStorage.ToyotaChaser, and this will only show for the client, if you need it to show for everyone, use a remote event

Log in to vote
0
Answered by 5 years ago

I'll use a normal Script instead.

Answer this question