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")
proximityPrompt.Triggered:Connect(function(player)
remoteEvent:FireAllClients("NightV")
print("1")
script.Parent.Parent:Destroy()
script.Parent:Destroy()
script:Destroy()
end)
Local script in Starter Gui.:
local function ItemGet(armor)
print("2")
if armor == "Raptor1" then
--scriptssss
end
elseif armor == "Raptor2" then
---scriptts
end
end
Item.OnClientEvent:Connect(ItemGet)
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.
end
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:
-- Server
Event:FireServer(Player, ArgumentOne, ArgumentTwo, ArgumentThree)
You can send as many arguments as you like.
And to recieve on the local script do this:
-- Server
Event.OnClientEvent:Connect(function(ArgumentOne, ArgumentTwo, ArgumentThree)
print("Got arguments.")
end)
You only need to pass the player to FireServer, if your using FireAllClients then obviously you don’t need to pass any player object.
Here is a video that explains what it does, so when I pick it up the whole server gets it, it shows all the scripts.
I hope this makes it clear, sorry for taking so long.