Removing tool from starter gear Shop

Hello!

I’m currently stumped on a shop script I’ve been working on. The jist of the script is that a player will approach the shop vendor for spell upgrades that add a new GUI element to their tool allowing them to cast a new spell while also adding a tool to their starter gear that is basically the same tool but with the GUI element they just purchased included and removes the old tool they just upgraded from their starting gear. This works mostly as planned but I’m really struggling to get the removal of the old tool from the starter gear to work. Any suggestions?

Blockquote

Cash = script.Parent.Parent.Parent.Parent.Parent.leaderstats.Gold
Level = script.Parent.Parent.Parent.Parent.Parent.leaderstats.Level

function onClick()
if Level.Value >= 5 and Cash.Value >= 500 then
Cash.Value = Cash.Value - 500
local SpellTome = game.ServerStorage.TomeUpgrades.Storm.Root:clone()
SpellTome.Parent = script.Parent.Parent.Parent.Parent.Parent.PlayerGui.SpellGui.SpellGuiFrame
local SpellGear = game.ServerStorage.TomeUpgrades.Storm.StormTome2:clone()
SpellGear.Parent = script.Parent.Parent.Parent.Parent.Parent.StarterGear
local SpellRemove = script.Parent.Parent.Parent.Parent.Parent.StarterGear.StormTome:remove()
end
end

script.Parent.MouseButton1Click:connect(onClick)

Blockquote

Try this doing this instead of remove and show dev output

I replaced my original SpellRemove lines with what you suggested and am now getting the following error in output.

" StormTome is not a valid member of StarterGear “Players.shadow580.StarterGear” - Server - BuyScript:11"

When you equip a tool, it gets moved inside your character. Was the tool in your starter gear when you tested it?

Yea I had the tool in my starter gear before trying the shop out and it still wont remove the tool. And since I’m trying to get the tool removed from my starter gear rather than my backpack me having the tool equipped shouldnt be an issue.

Can you include a picture of the explorer because it’s very hard to understand where things are in your script; It only mentions Storm Tome once and it’s hard to understand the error if it’s not a direct issue of the code provided.

Also, sorry I thought they were the same thing for a second.

So the script still works as intended and adds the tool from server storage as it did before; its just the removal from starter gear that isnt functioning. I’ve also thrown in a picture of my explorer that shows where the script is pulling from.

Where is the original storm tome coming from and where is the script located.

So the original tome is pretty much just being added to my own starter gear in game by myself in studio.
I’m planning on adding a script that adds the tome to the players starter gear once they select a class down once i get the shop taken care of.

Make sure you add the tool when viewing the server and not the client because it won’t replicate. It seems you are using a server-sided script to remove it, and it’s important that it’s replicated to the server. Otherwise, I don’t see any issues with your code that would cause an error.

You can change your game to view the server by going to the test tab and click the button that says ‘current: client’.

Ah, that makes more sense and everything is working smoothly! Thanks for the quick replies!