Ok my basic shop script needs to send a script to the player's backpack. (I have starter gear too cause that's how I remember to make these kinda scripts) But when the player buys the item, it sends the script, instead of a copy. If another player tries to buy theitem it says "SlvrEnable Is not a valid member of replicated storage" and they cant get it. Any idea on what I'm doing wrong? If its filtering enabled I will cry cause I'm good at it XD.
SlvrEnable = game.ReplicatedStorage.SlvrEnable game.ReplicatedStorage.SlvrPurchase.OnServerEvent:Connect(function(Player) if Player.leaderstats.Coins.Value >= 25 then Player.leaderstats.Coins.Value = Player.leaderstats.Coins.Value - 25 Player:WaitForChild ("Backpack") game.ReplicatedStorage.SlvrEnable:Clone()SlvrEnable.Parent = Player.Backpack game.ReplicatedStorage.SlvrEnable:Clone()SlvrEnable.Parent = Player.StarterGear else print ("not enough money") end end)
There is an error on lines 7 and 8. You don't put the name after :Clone(), just the .Parent
Updated Code:
local SlvrEnable = game.ReplicatedStorage.SlvrEnable game.ReplicatedStorage.SlvrPurchase.OnServerEvent:Connect(function(Player) if Player.leaderstats.Coins.Value >= 25 then Player.leaderstats.Coins.Value = Player.leaderstats.Coins.Value - 25 local Backpack = Player:WaitForChild ("Backpack") game.ReplicatedStorage.SlvrEnable:Clone().Parent = Backpack game.ReplicatedStorage.SlvrEnable:Clone().Parent = Player.StarterGear else print ("not enough money") end end)
Well, you treated the variable 'SlvrEnable' as it has been cloned in two places...
game.ReplicatedStorage.SlvrEnable:Clone()SlvrEnable.Parent = Player.Backpack
game.ReplicatedStorage.SlvrEnable:Clone()SlvrEnable.Parent = Player.StarterGear
You have made the Clone but you are not using it I would do this...
local Clone = SlvrEnable:Clone() Clone.Parent = Player.StarterGear
Also... you didnt use the variable you defined which is a waste of code I would use
SlvrEnable = game.ReplicatedStorage.SlvrEnable