I really have no clue what's wrong with this script, the Admin panel frame does not go visible. You can't click the players torso and the Player profile gui does not come up when you do.
And at the bottom of the script is where the donation system is, I am using a leader stat called cash. What's wrong with my script? Can you tell me what I was doing wrong and why it does not work?
wait()
Admin = {"IntellectualBeing"}
local pr = game.Players.LocalPlayer
local Frame = script.Parent.Content.AdminPanel
for i = 1, #Admin do
if pr.Name == Admin[i] then
Frame.Visible = true
else
Frame.Visible = false
print('You do not have permission to view this!')
end
end
local me = game.Players.LocalPlayer
local mouse = me:GetMouse();
local FrameB = script.Parent.Content
local Title = FrameB.Title
plr = script.Parent.Player
mouse.Button1Down:connect(function()
if mouse.Target == "Part" and game.Players:GetPlayerFromCharacter(mouse.Target.Parent) then
plr.Value = game.Players:GetPlayerFromCharacter(mouse.Target.Parent)
if plr.Value~=nil then
FrameB.Visible = true
Title.Text = plr.Value.Name.."'s Profile"
else
end
end
end)
repeat wait() until plr.Value ~= nil
--
--Define variables just in case (Resetting)
local Cash = me.leaderstats.Cash --Leaderstats is the stat holder inside the player
local OCash = plr.Value["leaderstats"].Cash --For the player that the points are going too.
local Dbutton = FrameB.Page.DonateButton
local Input = FrameB.Page.Input
Dbutton.Button1Down:connect(function()
if Cash.Value <= tonumber(Input.Text) then
Cash.Value = (Cash.Value - (tonumberInput.Text))
OCash.Value = (OCash.Value + (tonumberInput.Text))
end
end)

2 comments
I'm a little confused on what is going on at lines 1-11. Also would I just input the admin frame stuff above everything else or have it in another script?
You should delete everything after line 33 and then insert this script. It waits until the Player value changes (that happens when you click someones torso), and it checks if there already is an event connected to the donate button: if thats the case disconnect that event.