Help with Scripting ProximityPrompt Team change using in-game currency

So I’m trying to make ProximityPrompt Team Change but you need to pay In-game cash if you want to be in that team but I have no idea on how to make it cause I’m not experienced on this can someone help

– My cash script
– My game proximityprompt team change

Also if you are good scripter and want to help me for free just tell me

2 Likes

When the proximity prompt is activated, use this code in the function:

local cost = 200 --Price to join team
if player.leaderstats.Cash.Value >= cost then
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - cost
player.Team = game.Teams.Monke
player:LoadCharacter() --Respawn them after they join the team
end

1 Like

Hey, Prompts have a Triggered event that can be used when triggered. Also comes with a player parameter for the player that activated the prompt.

--code from the API reference
 
proximityPrompt.Triggered:Connect(function(player)
    --you can switch the players team here and check their money by using the player parameter 
end)

Heres the docs (and tutorial):
Implementing Proximity Prompts (roblox.com)
ProximityPrompt (roblox.com)

And on how to change teams:

--just set the players team to the teams instance
player.Team = TeamInstance
1 Like

Thanks for helping, also do I put the script inside ProximityPrompt?

Thanks man, for helping me I was confuse and asking some friend before

1 Like

YOu can put the script anywhere. It just has to inside the function that will detect if the proximity prompt is activated/triggered.

Nope, sorry. Own a development group and am updating games and also making a horror game.

What kind of horror game, sorry for asking I kinda like horror game and I have one before

This is off topic so let me send you a message.

1 Like