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

Why can't other players see the bought tools?

I am trying to make a store GUI which gives the player a tool. The problem is, only your player can see it, to other players it looks like just an outstretched arm with nothing in it. It is in a local script, because putting it in a normal script removes the wrong amount of money.

code:

local item = game.ReplicatedStorage.tools.TurkeyLeg 
local mainwindow = script.Parent.Parent 
local money = script.Parent.Parent.Parent.Parent.Parent.Money

script.Parent.MouseButton1Click:Connect(function() 
    if money.Value >= 15 then 
	local clone = item:Clone()
	clone.Parent = script.Parent.Parent.Parent.Parent.Parent.Backpack
        money.Value = money.Value - 15 
        script.order:Play() 
    end 
end) 

1 answer

✓ Accepted answer

It's because you are using the client to give the LocalPlayer the item, only the client will be able to see it. Fire a remote event that will give the player the item on the serverside then everyone will be able to see it.


-- Create a script (not a localscript) inside a new RemoteEvent
script.Parent.OnServerEvent:Connect(function(plr) -- When you fire a RemoteEvent from the client the first argument that will be passed will be the player who fired it
end)

2 comments

0

should i put the remote event inside the gui?

0

Wherever you want, you can fire it from any localscript

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