Script: add to inventory does not work?

But that wouldn’t replicate and so the server woudn’t be able to access it!

ye true,

local
script.Parent.Activated:Connect(function()
game.ReplicatedStorae.EventName:FireServer()
end)
server
local Event = Instance.new(“RemoteEvent”,game:GetService(“ReplicatedStorage”))
Event .OnServerEvent:Connect(function(player)
if player:FindFirstChild(“leaderstats”) and player:FindFirstChild(“leaderstats”).Stars.Value >= 1 then
game.ServerStorage.ShopItems.FluffyUnicorn.Clone().Parent = player.backpack
end
end)

Okay Dandcx and Whois_Ciara,
first thing: thanks for the help, its appreciated!

Now, I have made a RemoteEvent in the ReplicatedStorage named RemoteEvent, lol.
and a localscript inside of the button, which is the one above and the other script in the ServerScriptService, but the buy button doesnt seem to work yet.

So I did now

script.Parent.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.RemoteEvent1:FireServer()
	
end)

And there is a RemoteEvent1 in the Repl. Storage

Yes that should work, then do the if statement in the normal script

I won’t bore you with the details but exploiters can change stats on client side so try and keep checkings on the server side (which they cant access)

oh thanks lol!
well i dont think any player will play my game so exploiters won’t be a problem haha

Okay, so the normal script should be the one WhoIsCiara posted a few minutes ago?

  • inside of the ServerScriptService?

Yup, client is local scripts and server is normal scripts

I did this in the Normal Script in the ServerScriptService:

game:GetService("ReplicatedStorage").RemoteEvent1.OnServerEvent:Connect(function(player)
	if player:FindFirstChild("leaderstats") and player:FindFirstChild("leaderstats").Stars.Value >= 1 then
		game.ServerStorage.ShopItems.FluffyUnicorn.Clone().Parent = player.backpack
	end
end)

correct?

Yes but capitalise Backpack, I think this should work

It doesn’t work, strange enough and I thought I did everything correct

Are there any errors inside the output that might be the problem?

no, there aren’t any errors :confused:

Maybe FluffyUnicorn:Clone() ? Unless you’ve already cloned the item.

it works!!! Thanks for your help

Np, could you mark as solution please lol

lol i feel bad doing that because everyone helped so much lol but yea of course

lol yea, sometimes the most frustrating errors to find are simple grammar errors