I have a local script that detects when a players level is more than the required exp needed:
local player = game.Players.LocalPlayer
local leaderstats = player:WaitForChild("leaderstats")
local exp = leaderstats:WaitForChild("Exp")
local reqexp = leaderstats:WaitForChild("RequiredExp")
local level = leaderstats:WaitForChild("Level")
player:WaitForChild("leaderstats").Exp.Changed:Connect(function(Changed)
if exp.Value >= reqexp.Value then
print("start")
game:GetService("ReplicatedStorage"):WaitForChild("Changing"):FireServer(exp, level, reqexp)
print("end")
end
end)
Here is the script used to detect when the remote event is fired:
script.Parent.OnServerEvent:Connect(function(plr, exp, level, reqexp)
print("Fired")
local leaderstats = plr.leaderstats
local aftermath = exp.Value - reqexp.Value
exp.Value = aftermath
level.Value += 1
reqexp.Value += 250
end)
The ‘start’ and ‘end’ print statements from the Localscript fire, however, the ‘fired’ statement from the server script does not. Any help is appreciated