So I'm trying to make stats in a game work with Filtering Enabled, and I'm having problems in the server script in a remote event. There's a value I put in the character's humanoid called XP Multiplier, and it's going to be important for future things in the game. Whenever I try to up my stats by pressing keys, it does the animation and everything it's supposed to in the local script, but it pops up ServerScriptService.UpStats:23: attempt to index local 'multiplier' (a nil value) in the server script. ** Server:**
local remoteEvent = game.ReplicatedStorage.UpStats
remoteEvent.OnServerEvent:connect(function(player, stat)
local strengthf = player.Stats.Strength
local speedf = player.Stats.Agility
local jumpf = player.Stats.Jump
local strengthLvl = strengthf.StrengthLevel
local speedLvl = speedf.AgilityLevel
local jumplvl = jumpf.JumpLevel
local sxp = strengthf.StrengthXp
local axp = speedf.AgilXp
local jxp = jumpf.JumpXp
local multiplier = game.Workspace[player.Name].Humanoid:FindFirstChild("XP Multiplier")
if stat == "strength" then
sxp.Value = sxp.Value + (math.random(40,60)*multiplier.Value)
elseif stat == "agility" then
axp.Value = axp.Value + (math.random(30,50)*multiplier.Value)
elseif stat == "jump" then
jxp.Value = jxp.Value + (math.random(30,50)*multiplier.Value)
end
end)
Local:
local player = game.Players.LocalPlayer
local char = player.Character
local stats = player:WaitForChild("Stats")
local leaderstats = player:WaitForChild("leaderstats")
local UIS = game:GetService("UserInputService")
local inmotion = false
local multiplier = char.Humanoid:WaitForChild("XP Multiplier")
local running = script:WaitForChild("Running")
local damage = false
local db = false
local remoteEvent = game.ReplicatedStorage.UpStats
local strength = stats:WaitForChild("Strength")
local strengthlvl = strength:WaitForChild("StrengthLevel")
local sxp = strength:WaitForChild("StrengthXp")
local smax = strength:WaitForChild("StrengthMaxXp")
local pushwaittime = 3
local agility = stats:WaitForChild("Agility")
local agillvl = agility:WaitForChild("AgilityLevel")
local axp = agility:WaitForChild("AgilXp")
local amax = agility:WaitForChild("AgilMaxXp")
local lungewaittime = 2.2
local jump = stats:WaitForChild("Jump")
local jumplvl = jump:WaitForChild("JumpLevel")
local jxp = jump:WaitForChild("JumpXp")
local jmax = jump:WaitForChild("JumpMaxXp")
local squatwaittime = 1.8
local stamStuff = player:WaitForChild("StaminaStuff")
local stamina = stamStuff:WaitForChild("Stamina")
local maxStam = stamStuff:WaitForChild("MaxStamina")
local squatanim = "rbxassetid://2219181231"
local lungeanim = "rbxassetid://2380575156"
local pushanim = "rbxassetid://2219303213"
local punch1 = "rbxassetid://2219184536"
local punch2 = "rbxassetid://2219185342"
local punch3 = "rbxassetid://2219186257"
local punch4 = "rbxassetid://2219189003"
local runAnimId = "rbxassetid://2394625968"
local punch1wait = 0.5
local punch2wait = 0.5
local punch3wait = 0.5
local punch4wait = 0.5
-- Squat
UIS.InputBegan:connect(function(key)
if key.KeyCode == Enum.KeyCode.C then
if inmotion == false and db == false then
inmotion = true
db = true
local anim = Instance.new("Animation")
anim.AnimationId = squatanim
local squat = char.Humanoid:LoadAnimation(anim)
squat.Priority = Enum.AnimationPriority.Action
squat:Play()
wait(squatwaittime)
remoteEvent:FireServer("jump")
squat:Stop()
inmotion = false
db = false
end
end
end)
-- Lunge
UIS.InputBegan:connect(function(key)
if key.KeyCode == Enum.KeyCode.X then
if inmotion == false and db == false then
inmotion = true
db = true
local anim = Instance.new("Animation")
anim.AnimationId = lungeanim
local lunge = char.Humanoid:LoadAnimation(anim)
lunge.Priority = Enum.AnimationPriority.Action
lunge:Play()
wait(lungewaittime)
remoteEvent:FireServer("agility")
lunge:stop()
inmotion = false
db = false
end
end
end)
-- Pushup
UIS.InputBegan:connect(function(key)
if key.KeyCode == Enum.KeyCode.Z then
if inmotion == false and db == false then
inmotion = true
db = true
local anim = Instance.new("Animation")
anim.AnimationId = pushanim
local pushanim = char.Humanoid:LoadAnimation(anim)
pushanim.Priority = Enum.AnimationPriority.Action
pushanim:Play()
wait(pushwaittime)
pushanim:Stop()
remoteEvent:FireServer("Strength")
inmotion = false
db = false
end
end
end)
-- Sprint
UIS.InputBegan:connect(function(key)
if key.KeyCode == Enum.KeyCode.LeftControl then
if running.Value == false then
if inmotion == false and stamina.Value >= 0 then
local anim = Instance.new("Animation")
anim.AnimationId = runAnimId
runAnim = char.Humanoid:LoadAnimation(anim)
runAnim.Priority = Enum.AnimationPriority.Action
inmotion = true
running.Value = true
runAnim:Play()
runAnim:AdjustSpeed((agillvl.Value*0.002+1.1))
char.Humanoid.WalkSpeed = agillvl.Value * 0.3 + 25
char.Humanoid.JumpPower = jumplvl.Value * 0.5 + 60
while running.Value == true and wait(0.1) do
if stamina.Value > 0 then
stamina.Value = stamina.Value - 1
elseif stamina.Value <= 0 then
inmotion = false
running.Value = false
runAnim:Stop()
char.Humanoid.WalkSpeed = 16
char.Humanoid.JumpPower = 50
break
end
end
end
elseif running.Value == true then
inmotion = false
running.Value = false
runAnim:Stop()
char.Humanoid.WalkSpeed = 16
char.Humanoid.JumpPower = 50
end
end
end)
-- Punching
local punching = false
local count = 0
UIS.InputBegan:connect(function(key)
if key.KeyCode == Enum.KeyCode.E and damage == false then
local anim = Instance.new("Animation")
if db == false and damage == false then
if count == 0 then
db = true
anim.AnimationId = punch1
local punchanim = char.Humanoid:LoadAnimation(anim)
punchanim.Priority = Enum.AnimationPriority.Action
punchanim:Play()
char.LeftHand.Touched:connect(function(hit)
if damage == false then
if punching == false then
punching = true
hit.Parent.Humanoid:TakeDamage(math.random(strengthlvl.Value+10,strengthlvl.Value+20))
damage = true
wait(punch1wait)
damage = false
end
end
end)
damage = true
wait(punch1wait)
damage = false
punchanim:Stop()
count = 1
db = false
punching = false
elseif count == 1 then
db = true
anim.AnimationId = punch2
local punchanim = char.Humanoid:LoadAnimation(anim)
punchanim.Priority = Enum.AnimationPriority.Action
punchanim:Play()
char.RightHand.Touched:connect(function(hit)
if damage == false then
if punching == false then
punching = true
hit.Parent.Humanoid:TakeDamage(math.random(strengthlvl.Value+10,strengthlvl.Value+20))
damage = true
wait(punch2wait)
damage = false
end
end
end)
damage = true
wait(punch2wait)
damage = false
punchanim:Stop()
count = 2
db = false
punching = false
elseif count == 2 then
db = true
anim.AnimationId = punch3
local punchanim = char.Humanoid:LoadAnimation(anim)
punchanim.Priority = Enum.AnimationPriority.Action
punchanim:Play()
char.LeftFoot.Touched:connect(function(hit)
if damage == false then
if punching == false then
punching = true
hit.Parent.Humanoid:TakeDamage(math.random(strengthlvl.Value+10,strengthlvl.Value+20))
damage = true
wait(punch3wait)
damage = false
end
end
end)
damage = true
wait(punch3wait)
damage = false
punchanim:Stop()
count = 3
db = false
punching = false
elseif count == 3 then
db = true
anim.AnimationId = punch4
local punchanim = char.Humanoid:LoadAnimation(anim)
punchanim.Priority = Enum.AnimationPriority.Action
punchanim:Play()
char.RightFoot.Touched:connect(function(hit)
if damage == false then
if punching == false then
punching = true
hit.Parent.Humanoid:TakeDamage(math.random(strengthlvl.Value+10,strengthlvl.Value+20))
damage = true
wait(punch4wait)
damage = false
end
end
end)
damage = true
wait(punch4wait)
damage = false
punchanim:Stop()
count = 0
db = false
punching = false
end
end
punching = false
end
end)
Also sorry for cramming so many different things into the local script, but the local script I don't think is the problem.

6 comments
Not going to read through your 200 line LocalScript. What ValueBase type is multiplier?
Is multiplier ever being destroyed?
No it's not, and it's an IntValue.
Why would you post 254 lines of code you "don't think is the problem", yet omit the critical piece of code which is where "XP Multiplier" is actually created and parented to the Humanoid? Your problem is not in this code you're showing us, you're probably creating or parenting the value object from a LocalScript.
You never know where the problem might lie. I put it there just in case the problem ended up being there anyway, but why are you complaining when it doesn't even show the full script unless you want it to? Also, what if someone wanted to try and learn from my script? It might be a bad idea, but there's no reason in complaining for something no one has to do.
More code is only better when it's guaranteed to include the bug :-) I mean a working repro rbxl. If the bug is not in the code you include, then more code is worse because means people who genuinely want to help will just be wasting more time looking for something that isn't there. It wasn't so much a complaint, as a "Y U DO THIS?" comment. I knew what the problem was from the error message.