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

ToyotaChaser not a valid member of ServerStorage?

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.

1 comment

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

3 answers

✓ Accepted answer

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

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

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