Multiply multiple values

I’m trying to make a multiply value system for my clicker sim i’m trying to make it so that it takes my multiply value and then it multiply’s it by 1 then adds the answer to clicks value but it doesn’t seem to work it prints 0 no matter what the multiply value is i will leave the server script code and then the local script code below let me know if you know the reason for this thanks!
Server Script Code:
game.ReplicatedStorage.Clicksdetection.GroupAutoClicker.OnServerEvent:Connect(function(player, clicks)
local result = player:FindFirstChild(“leaderstats”).multiplier.Value * 1
clicks.Value += result
print(result)
end)
Local Script Code::
local clickinggui = script.Parent
local localplayer = game.Players.LocalPlayer

local leaderstats = localplayer:FindFirstChild(“leaderstats”)
local Clicks = leaderstats:FindFirstChild(“Clicks”)
local clicked = clickinggui.FreeAutoClick.Clicked
local freeautoclicker = clickinggui.FreeAutoClick.Clicked

clickinggui.FreeAutoClick.MouseButton1Click:Connect(function()

if not localplayer:IsInGroup(16061187) then
	return
end

local autoclick = freeautoclicker
 if freeautoclicker.Value == true then
		freeautoclicker.Value = false
 elseif freeautoclicker.Value == false then
		freeautoclicker.Value = true
 end

if freeautoclicker.Value == true then
	repeat 
		task.wait(1.375) -- Delay (time between clicks)
		game.ReplicatedStorage.Clicksdetection.GroupAutoClicker:FireServer(Clicks)
	until not freeautoclicker.Value
end

end)

print out everything you think is suspicious.

print(player)
print(player:FindFirstChild(“leaderstats”))
local multiplier = player:FindFirstChild(“leaderstats”).multiplier
print(multiplier, typeof(multiplier))
local value = player:FindFirstChild(“leaderstats”).multiplier.Value
print(value, typeof(value))

Doesn’t this happen because the character always starts with 0 points and multiplying it by 1 will always give 0?
From what I can see, the only thing in your script that changes the player’s score is after this multiplication.
I don’t think your code has a error, I think it’s just poorly written. A basic adjustment will solve it.

No cuzz even when i give the character 500 points it still prints 0

I don’t think this is the pb i have no idea what is tbh but i don’t think this is it cuzz it seems to work fine

I just answered another user more or less with your problem. It doesn’t look like a script error, it looks like poorly written code. You need to check the steps in your code, like, what is clicks? (It seems to be an IntValue). Your multiplier always multiplies the same value, nothing related to clicks, how do you expect anything different? In order for it not to print 0, you need to change the value of multiplier in leaderstats.

yes you are right i changed it in leaderstats to 500 and it seems to have worked and printed 500 but how do i change it outside of the leaderstats script

Shouldn’t the base multiplier be 1 point? It seems that the error occurs because it comes as 0 by default. Leave it as 1 and it should solve the problem.
Go to the script where you create the multiplier instance and change the multiplier.Value to 1.

it worked but then when i tested the game and i tried to change the value it seems to not multiply it

Change it on the server instead of the client, that might work.

ye thats what i did i changed it on the server and when i test it and then i go to players the multiplier value and change the number to 500 it doesn’t print 500 only prints 1

What I’m trying to say is when i try to change the multiply value after the game starts it doesn’t work

The pb was that when you add to that value as ur testing it counts as you made that change on the client side but if you click server side button on top of Roblox studio ui it changes it to server side so if i was to test play it and change the value on the client side only local scripts can see and server scripts cant see that and if i was to test play it on the server and changed the value on the server side then local scripts can’t see it and server scripts can see it

Thank you everyone for you’er help!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.