So It’s a inventory gui, If a player pick the item up the script detects it( The script is in the item)
and the whole server sees the item in their gui but I only want the player that picks it up has it in their gui
script in the item =
local proximityPrompt = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("Item")
Local script in Starter Gui.:
local function ItemGet(armor)
if armor == "Raptor1" then
elseif armor == "Raptor2" then
Not quite sure what the problem is here. Each instance of a local script is running on a per client basis so there’s really no need for the sort of check you’re doing. Are you using FireAllClients() only? If so you can use FireClient(Player) to activate it for only the one player.
Read @TimesIllusion’s answer, about using FireClient. But if for some reason you are intending to use your current system, assuming “player” is a player object, you should correct your code to the following:
if player == game.Players.LocalPlayer then
-- The script is here.
Also upper case Game has been deprecated, use game.
I’m not really clear on what your trying to do, but yeah you can pass arguments through events, so from the server you could pass the armor name and then on the local script you could check which amour it is and do whatever you have to do.
To send arguments do this:
Event:FireServer(Player, ArgumentOne, ArgumentTwo, ArgumentThree)
You can send as many arguments as you like.
And to recieve on the local script do this:
Event.OnClientEvent:Connect(function(ArgumentOne, ArgumentTwo, ArgumentThree)
You only need to pass the player to FireServer, if your using FireAllClients then obviously you don’t need to pass any player object.