I need this script to change the player's values, how ever and error appears that says:
16:18:37.775 - Workspace.Level:9: attempt to perform arithmetic on field 'DogeXP' (a userdata value)
16:18:37.777 - Stack Begin
16:18:37.778 - Script 'Workspace.Level', Line 9
16:18:37.779 - Stack End
Here is the script:
--ServerScript
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local LevelEvent = ReplicatedStorage:WaitForChild("LevelEvent")
LevelEvent.Name = "LevelEvent"
local Random = math.random(10,20)
local function onLevelFired(player)
math.randomseed(tick())
local Stats = player.Stats
Stats.DogeXP.Value = Stats.XPNext.Value - Stats.DogeXP
Stats.XPNext.Value = Stats.XPNext.Value * 5
Stats.MaxHealth.Value = Stats.MaxHealth.Value + Random
Stats.MaxHunger.Value = Stats.MaxHunger.Value + Random
Stats.Speed.Value = Stats.Speed.Value + 0.5
game.workspace[player.Name.."Dog"].RocketPropulsion.MaxSpeed = Stats.Speed.Value
if player.Stats.Level.Value == 1 then
game.workspace[player.Name.."Dog"].ShowName.txt.Text = player.Name.."'s Baby Doge [Level 1]"
elseif player.Stats.Level.Value == 2 then
game.workspace[player.Name.."Dog"].ShowName.txt.Text = player.Name.."'s Doge [Level 2]"
elseif player.Stats.Level.Value == 3 then
game.workspace[player.Name.."Dog"].ShowName.txt.Text = player.Name.."'s Normal Doge [Level 3]"
elseif player.Stats.Level.Value == 4 then
game.workspace[player.Name.."Dog"].ShowName.txt.Text = player.Name.."'s Growing Doge [Level 4]"
elseif player.Stats.Level.Value == 5 then
game.workspace[player.Name.."Dog"].ShowName.txt.Text = player.Name.."'s Flying Doge [Level 5 (Upgrade 1)]"
elseif player.Stats.Level.Value == 6 then
game.workspace[player.Name.."Dog"].ShowName.txt.Text = player.Name.."'s Faster Doge [Level 6]"
elseif player.Stats.Level.Value == 7 then
game.workspace[player.Name.."Dog"].ShowName.txt.Text = player.Name.."'s Cool Doge [Level 7]"
elseif player.Stats.Level.Value == 8 then
game.workspace[player.Name.."Dog"].ShowName.txt.Text = player.Name.."'s Powerful Doge [Level 8]"
elseif player.Stats.Level.Value == 9 then
game.workspace[player.Name.."Dog"].ShowName.txt.Text = player.Name.."'s Super Doge [Level 9]"
elseif player.Stats.Level.Value == 10 then
game.workspace[player.Name.."Dog"].ShowName.txt.Text = player.Name.."'s Super Duper Doge [Level 10 (Upgrade 2)]"
elseif player.Stats.Level.Value == 11 then
game.workspace[player.Name.."Dog"].ShowName.txt.Text = player.Name.."'s Extreme Doge [Level 11]"
elseif player.Stats.Level.Value == 12 then
game.workspace[player.Name.."Dog"].ShowName.txt.Text = player.Name.."'s Amazing Doge [Level 12]"
elseif player.Stats.Level.Value == 13 then
game.workspace[player.Name.."Dog"].ShowName.txt.Text = player.Name.."'s Super Doge [Level 13]"
elseif player.Stats.Level.Value == 14 then
game.workspace[player.Name.."Dog"].ShowName.txt.Text = player.Name.."'s EPIC Doge [Level 14] (Upgrade 3)"
elseif player.Stats.Level.Value == 15 then
game.workspace[player.Name.."Dog"].ShowName.txt.Text = player.Name.."'s LEGENDARY Doge [Level 15] (Max Upgrade (4), Max Level)"
end
end
LevelEvent.OnServerEvent:Connect(onLevelFired)

6 comments
Thats true
Oh. Thanks!
No problem!
If he used filtering enabled doesn't he need to call the event??
It's in a server script so he doesn't need to
I already called the event anyway.