Im getting an error even though i have said model in said location

  1. What do you want to achieve? Get a model in ServerStorage. So i can show the hit box of it.

  2. What is the issue? Im getting this error
    21:49:53.569 - Coin is not a valid member of ServerStorage "ServerStorage"idk what this is i have so many games - Roblox Studio 10_27_2020 9_54_07 PM (2)

  3. What solutions have you tried so far? I have checked my code and I am calling the correct model but I still get the error here is my code incase the error is in the code

local debounce = false

script.Parent.MouseButton1Click:Connect(function()
	if debounce == false then
		debounce = true
		game.ServerStorage.Coin.PrimaryPart.Transparency = .5
		for i, coinspawn in pairs(workspace.CoinSpawns:GetChildren()) do
			if coinspawn:FindFirstChild("Coin") then
				coinspawn.Coin.PrimaryPart.Transparency = .5
			end
		end
	else
		debounce = false
		game.ServerStorage.Coin.PrimaryPart.Transparency = 1
		for i, coinspawn in pairs(workspace.CoinSpawns:GetChildren()) do
			if coinspawn:FindFirstChild("Coin") then
				coinspawn.Coin.PrimaryPart.Transparency = 1
			end
		end
	end
end)

Where’s the line that causes the error? I’m sorry if i don’t inspect enough because i’m kind of busy and rushing rn.

game.ServerStorage.Coin.PrimaryPart.Transparency = .5

Is there a separate script removing coin from serverstorage?

Where is this script being executed, on the client or the server?

Please remember that objects in ServerStorage cannot be retrieved from the client. You must use a remote event to access objects like that from the client.

1 Like

no. Although i do have a script that clones it and moves the clone out of it and renames it to “CoinClone”

client. So i could just move it to workspace and in a folder and move it far from the play area correct? or just go about it the way you said

Unless you only want this change to appear for 1 player instead of all players in the server, you should use a remote event to modify the properties of server-side objects.

I want it to show locally and thanks i didnt know that serverstorage items cant be detected by a local script

No problem! If you want it to show locally, I suggest using the ReplicatedStorage as objects in there can be modified/accessed by both the server and the client. However, if you modify something in ReplicatedStorage from the client, then it will only be displayed for that client which I believe is what you’re trying to achieve.

oh ok also thank you for the help i know how to script just dont know how some of the starter things in a new game work i really need to read more of the Dev API

No problem. I hope you continue to learn ROBLOX scripting! Good luck!

There is no waitforchild that waits for the coins to spawn if it hasn’t spawned, you should use that and it’ll probably fix the code.

I already fixed it the post has a reply marked as the solution

didn’t see, atleast its fixed.