I'm Trying to check if the player is in a specific team and has a the value of X then they could use the button can anyone help
local CoinWorth = 50
Button.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local Plr = workspace[hit.Parent.Name]
local Player = game.Players:GetPlayerFromCharacter(Plr)
if Player.Team == "Red" and Player.leaderstats.Coins.Value >= CoinWorth then
Player.leaderstats.Coins.Value = Player.leaderstats.Coins.Value - CoinWorth
end
end
end)

2 comments
Thanks :) For The Help I'm just a bit noobie when it comes to creating the script i know how i want to approach the problem just don't know the most eficient way to do it
No problem. Everyone was a beginner at a time.