Alternatives to Int Values

I want to make a simulator and I have ran into an issue in development.
I keep getting this error image .
I am trying to use an int value to store the amount of player points someone has.
I know that its because you can’t add use math with int values and I’m trying to find a different solution to this problem.

My question: Are there any close alternatives to using int values for this or any fixes to this issue?

Here is my script so far.

 - - game.Players.PlayerAdded:Connect(function(player)

      local serverstorage = game.ServerStorage

       local plrstats = Instance.new("Folder",serverstorage)

       plrstats.Name = player.Name

        local points = Instance.new("IntValue",serverstorage)

      points.Name = ("points")

    local remotes = game.ReplicatedStorage.Remotes

  remotes.Explode.OnServerEvent:Connect(function(plr,ppe)

points.Value = points.Value + ppe

       end)

end)

ppe is nil, make sure you are sending the right parameters.

1 Like

I am not sure I understand.

 - - local ppe = 10


script.Parent.Parent.Equipped:Connect(function()
	script.Parent.Parent.Activated:Connect(function(plr)
		local explode = require(script.Parent.ModuleScript)
		explode.Explode(plr,ppe)
	end)
end)

This is the first script that has the value in it.

local module = {}
function module.Explode()
	local ExplodeRemote = game.ReplicatedStorage.Remotes.Explode:FireServer(plr,ppe)
end
return module

Then to this script and finally to the first script I shared.
Does the problem with ppe being nil originate from the value being in a local script as a local variable?

Ok, so 1st of all, the module.Explode should have a parameter like this:

local module = {}
function module.Explode(ppe)
	local ExplodeRemote = game.ReplicatedStorage.Remotes.Explode:FireServer(plr,ppe)
end
return module

and 2nd of all, you don’t fire the remote event with a plr variable. It is automatic. So do this:

local module = {}
function module.Explode(ppe)
	local ExplodeRemote = game.ReplicatedStorage.Remotes.Explode:FireServer(ppe)
end
return module

and as for the local script, remove the plr parameter for calling the function like this:

local ppe = 10


script.Parent.Parent.Equipped:Connect(function()
	script.Parent.Parent.Activated:Connect(function(plr)
		local explode = require(script.Parent.ModuleScript)
		explode.Explode(ppe)
	end)
end)
2 Likes

I have taken your tips into my game and it worked! Thanks.

1 Like