I recently added an automatic promotion system to my game. Meaning when a player plays for 30 minutes for example, they get promoted up 1 rank. However, there’s a flaw with this. If they get demoted and they have the points required for a promotion, it automatically ranks them back. So I wanted to add an experience remover where my High Ranks can input how much experience they want to remove from them. This is the script I have so far (has player,name, send, money because I just copied the format from the citation system I developed bc lazy.
Money is the “experience” input value to be removed.
If anybody could help me with this, you’d be a life saver, I’ve been messing around with this script for 30 minutes with no promising outcome.(and yes, I plan on adding security to the remote event - there’s just no security as of now due to testing it in stuido.)
Unless the leaderstats aren’t parented to the player (I doubt it would be a leader stat then), if you don’t change the value of the leaderstat parented to the player, it won’t change the leaderstat.
Just for note (send) is the player to have leaderstats removed. It’s not removing the own player’s stats - but the person who’s inputted in the GUI that fires the event upon the demotion button being pressed.
name = player sending (along with player = player sending)
send = player being demoted
money = amount of experience being removed from player. I’ll try that - but I believe that’s a line I’ve already tried.
For further reference, here is the localscript located in the GUI.
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
local money = script.Parent.Parent.amount.Value
local send = script.Parent.Parent.username.Value
local name = script.Parent.Parent.name.Value
if game.Players:FindFirstChild(send) then
game.ReplicatedStorage.Demote:FireServer(name, send, money)
script.Parent.Parent.userna.Text = ''
script.Parent.Parent.TextBox.Text = ''
end
end)
@profak When I tried the print, it didn’t seem to make either of them work. I’m still rather new to Remote Event’s, even though I’ve done about 5 other features like this. Not sure if it’s the remote event messing up, or the line of code itself.
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
local money = script.Parent.Parent.amount.Value
local send = script.Parent.Parent.username.Value
local name = script.Parent.Parent.name.Value
print(send)
if game.Players:FindFirstChild(send) then
print("W1")
game.ReplicatedStorage.Demote:FireServer(name, send, money)
script.Parent.Parent.userna.Text = ''
script.Parent.Parent.TextBox.Text = ''
print("W2")
end
end)
I have it placed in ServerScriptStorage because that’s where I’ve had the Citation and Donation GUI’s Server Script located which they worked just fine, no issues at all.
Try printing at the beginning of your script, to see if it is even running, scripts in the ServerScriptService do run, unless their Disabled property is set to true