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

(SOLVED) Proximity Prompt for certain Teams?

The issue at hand is im creating a Delivery Team for an RP game and i want to limit the Proximity Prompt to ONLY be Used (and possibly seen) by the "Delivery" team

this is the script i have that is not working, ignore the // as they are not part of the actual code (im NEW to roblox coding so please be gentle)

// local player = game:GetService("Players")

// player.PlayerAdded:Connect(function(player)

// if player.TeamColor == BrickColor.new("Carnation pink") then

	// local prp = script.Parent

	// local pizza = game.ServerStorage.Pizza

           //  prp.Triggered:Connect(function(player)

	// pizza:Clone()

	// pizza.Parent = player.Backpack

	// game.StarterPlayer.Pizza.Value = true

	// prp.Enabled = false

	// end)	

// end  ))

1 comment

0

For this one, I had to make it as an experience because it has a lot of stuff in it. Anyway, the experience has an explanation in scripts. https://www.roblox.com/games/7417603339/Delivery-Team-tutorial

2 answers

I believe this is because it is in a server sided script. You would need to use a remoteEvent and fire it to the client, from the server. Add a remoteEvent to replicated Storage.

This would be your new server sided script.

local remoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEventName")
local player = game:GetService("Players")

player.PlayerAdded:Connect(function(player)

if player.TeamColor == BrickColor.new("Carnation pink") then

    local prp = script.Parent

    local pizza = game.ServerStorage.Pizza

    prp.Triggered:Connect(function(player)

    pizza:Clone()

    pizza.Parent = player.Backpack
    
    remoteEvent:FireClient(player, prp, pizza)

    end)    

end  ))

And this would be a localscript inside of replicatedFirst

local remoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEventName")

remoteEvent.OnClientEvent:Connect(function(prp, pizza)
    pizza.Value = true
    prp.Enabled = false

end)

Please tell me if you need more explanation or if something isn't working.

3 comments

0

i Followed your instruction the best i could but sadly it still does not work. https://gyazo.com/e19551dfb2ef246c845997cdbcf2e850

0

idk if it makes a difference but i am using a Spawner to change my team

0

Are there any errors? Also, in this code, the team that doesn't get to see the proximity prompt is the Carnation pink team.

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