Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Can anyone help me with doubling the cost of clicks?

i have tried to get the double cost to work in a kinds of ways but it never seems to work. This is one of the attempts:

local player= game. Players, Localplayer
local Coins= player.leaderstats:FindFirstChild("Coins")
local Rebirths = player.leaderstats:FindFirstChild( "Rebirths")
local price = script. Parent.Price.Value
local amount= script.Parent.Amount.Value


script.Parent.MouseButton1Click:Connect(function()
if Coins.Value >= price then
Coins.Value = 0
Rebirths.Value += amount
price = price * 2
end
end)

2 comments

0

game. Players, Localplayer should be game.Players.LocalPlayer, this "." means that you are trying to access property of something, in your case "LocalPlayer" property of "Players", also your script only changes Rebirths value locally only on your computer, no-one else will see this, see RemoteEvents to solve your issue

0

u7p4#6969

1 answer

✓ Accepted answer

This script should work.

local player = game.Players.LocalPlayer
local Coins = game.leaderstats:FindFirstChild("Coins")
local Rebirths = player.leaderstats:FindFirstChild("Rebirths")
local price = script.Parent.Price.Value
local amount = script.Parent.Amount.Value
script.Parent.MouseButton1Click:Connect(function()
	if Coins.Value >= price then
		Coins.Value -= price
	end
	Rebirths.Value += amount
	price = price * 2
end)

5 comments

0

game.leaderstats ?

0

Change the game.leaderstats to player.leaderstats and that should work.

0

if you could add me on discord and try and help that would be great i tried the code you put but i didn’t work

0

u7p4#6969

0

i sent you a friend request on discord, tell me the error on there and i can fix it.

This discussion is preserved as it was. New answers, comments, and votes are closed.