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

Why is the gear only on my screen?

So I have this shop and the gear is only on my screen my friend showed me a screenshot and every gear given to me is only on my screen and on his end it's just me holding my arm out with nothing in my hand.

Here is the code -

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
	if player.leaderstats.Coins.Value >= 1000 then
		player.leaderstats.Coins.Value = player.leaderstats.Coins.Value - 1000
		local clonar = game.ReplicatedStorage.SpeedCoil:Clone()
		clonar.Parent = player.Backpack
	end
end)

any help would be appreciated!

2 comments

0

If this is a local script, then all of this will only be on the client. To fix this, you probably should use a remote event / function

0

This can be a client/local script which runs client-sided (only for one device). You can use a remote event

1 answer

Make a script that will be in ServerScriptService and a RemoteEvent called "Buy"

local script:

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
    if player.leaderstats.Coins.Value >= 1000 then
        player.leaderstats.Coins.Value = player.leaderstats.Coins.Value - 1000
        game.ReplicatedStorage.Buy:FireServer(game.ReplicatedStorage.SpeedCoil)
    end
end)

Script:

game.ReplicatedStorage.Buy.OnServerEvent:Connect(function(Player, Item)
Item:Clone().Parent = Player.Backpack
end)

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