I need to if player don’t have 200 money then gui.visable = true, but it isn’t works
You need PlayerGui not StarterGui.
local Gui = player:WaitForChild(“PlayerGui”)
help please. idk how to do it.
Yes?
Replace this
with this
player:WaitForChild("PlayerGui").TeamChange.Panel.Visible = true
Just replace it like I said above.
Delete the local Gui on the top.
it is not working. I deleted it
Can you show me the code again?
And show me output.
Show me the output if there is any error.
Hello there,
EDITED: My bad, look at it wrongly. IEnforce_Lawz should be the solution to your problem.
no errors
Heres what you should be doing.
local player = game.Players.LocalPlayer
player:WaitForChild("PlayerGui").TeamChange.Panel.Visible = true
And are you changing the money Server sided?
No it is Script not local script I guess.
Plus he/she is getting the player variable from ProximityPrompt triggered event.
local replicatedstorage = game.ReplicatedStorage
local AK47 = replicatedstorage["AK-47"]
local Pistol = replicatedstorage.Pistol
local SMG = replicatedstorage.SMG
local Shotgun = replicatedstorage.Shotgun
local ProximityPrompt = script.Parent
ProximityPrompt.Triggered:Connect(function(player)
if player.leaderstats.Money.Value >= 200 then
player.leaderstats.Money.Value = player.leaderstats.Money.Value - 200
local number = math.random(1,4)
print(number)
if number == 1 then
local gun = AK47:Clone()
gun.Parent = player.Backpack
end
if number == 2 then
local gun = Pistol:Clone()
gun.Parent = player.Backpack
end
if number == 3 then
local gun = SMG:Clone()
gun.Parent = player.Backpack
end
if number == 4 then
local gun = Shotgun:Clone()
gun.Parent = player.Backpack
else
local player = game.Players.LocalPlayer
player:WaitForChild("PlayerGui").TeamChange.Panel.Visible = true
end
end
end)
Don’t works
Can you please show me your Money Value in the server?
it works if there is enough money
local replicatedstorage = game.ReplicatedStorage
local AK47 = replicatedstorage["AK-47"]
local Pistol = replicatedstorage.Pistol
local SMG = replicatedstorage.SMG
local Shotgun = replicatedstorage.Shotgun
local ProximityPrompt = script.Parent
ProximityPrompt.Triggered:Connect(function(player)
if player.leaderstats.Money.Value >= 200 then
player.leaderstats.Money.Value = player.leaderstats.Money.Value - 200
local number = math.random(1,4)
print(number)
if number == 1 then
local gun = AK47:Clone()
gun.Parent = player.Backpack
end
if number == 2 then
local gun = Pistol:Clone()
gun.Parent = player.Backpack
end
if number == 3 then
local gun = SMG:Clone()
gun.Parent = player.Backpack
end
if number == 4 then
local gun = Shotgun:Clone()
gun.Parent = player.Backpack
end
elseif player.leaderstats.Money.Value < 200 then
player:WaitForChild("PlayerGui").TeamChange.Panel.Visible = true
end
end
end)
edit it like this ^
(I changed the code make sure you are using this version)
The actual problem was that you missed end before the else now elseif that is checking if the value is less than 200.