How do I make my tycoon dropper script make my leaderstats a specific number?

I am trying to make my dropper script make my “level” stat go up a specific number, not ADDING I need it to change to a specific number. Everything else in the script is working correctly I just need help on this one thing.

wait(1.1)
local module = require(script.Parent.Parent.Parent.Parent.Parent.Settings)
local dropInfo = script.Parent.DropperInfo
local tcnInfo = script.Parent.Parent.Parent.TycoonInfo
local drop = script.Parent.Drop2
local mesh = script.Parent:FindFirstChild("CustomDrop2")
if mesh then mesh.Parent = nil end
while true do
	local part
	if mesh then
		part = mesh:Clone()
		part.Parent = workspace.Parts
		part.Transparency = 0
		part.Anchored = false
		part.CanCollide = true
	else
		part = Instance.new("Part", workspace.Parts)
		part.Material = tcnInfo.DropMaterial.Value
		part.BrickColor = BrickColor.new("Institutional white")
	end
	--make size 1,1,1
	part.Size = Vector3.new(0.6, 0.6, 0.6)
	part.CFrame = drop.CFrame
	local value = Instance.new('IntValue', part)
	value.Value = dropInfo.LevelValue.Value
	value.Name = 'Level'
	game.Debris:AddItem(part, module.dropLifeTime)
	wait(dropInfo.LevelTimer.Value)
end

make a on touched function for when the parts touch the pad (make sure you use input validation. So make sure the name of the part touched is correct so a player wouldnt be able to actiavte it) now when the part touched insted of doing plr.leaderstats.money.value += 100000 this would be adding money btw instead do plr.leaderstats.money.value = 100000 this is probably much longer than it needs to be but why cares

2 Likes

Could you give me an example? Im not that good at coding

I switched the script to a touch part and it worked! Btw its not money its suppose to be “level” my game is about upgrading a dropper so it just levels up

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