You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want to figure out the problem.
What is the issue? Include screenshots / videos if possible!
The issue is that my code deduct, the players taps by 10, it’s deducts it by another value.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I haven’t tried any solutions. Nor have looked on the developer form.
Here is the server script
local rs = game:GetService("ReplicatedStorage")
local rbfr = rs:WaitForChild("RebirthFrameFR")
rbfr.OnServerInvoke = function(p)
local bs = {game.StarterGui.MainGUI.RebirthFrame.ScrollingFrame.Button1, game.StarterGui.MainGUI.RebirthFrame.ScrollingFrame.Button2, game.StarterGui.MainGUI.RebirthFrame.ScrollingFrame.Button3, game.StarterGui.MainGUI.RebirthFrame.ScrollingFrame.Button4, game.StarterGui.MainGUI.RebirthFrame.ScrollingFrame.Button5}
if bs[1].Activated then
if p:WaitForChild("leaderstats"):WaitForChild("Taps").Value >= bs[1].Price.Value then
p:WaitForChild("leaderstats"):WaitForChild("Taps").Value -= bs[1].Price.Value
p:WaitForChild("leaderstats"):WaitForChild("Rebirths").Value += 1
p:WaitForChild("leaderstats"):WaitForChild("Gems").Value += bs[1].Price.Value * 10
end
end
if bs[2].Activated then
if p:WaitForChild("leaderstats"):WaitForChild("Taps").Value >= bs[2].Price.Value then
p:WaitForChild("leaderstats"):WaitForChild("Taps").Value -= bs[2].Price.Value
p:WaitForChild("leaderstats"):WaitForChild("Rebirths").Value += 2
p:WaitForChild("leaderstats"):WaitForChild("Gems").Value += bs[2].Price.Value * 10
end
end
if bs[3].Activated then
if p:WaitForChild("leaderstats"):WaitForChild("Taps").Value >= bs[3].Price.Value then
p:WaitForChild("leaderstats"):WaitForChild("Taps").Value -= bs[3].Price.Value
p:WaitForChild("leaderstats"):WaitForChild("Rebirths").Value += 5
p:WaitForChild("leaderstats"):WaitForChild("Gems").Value += bs[3].Price.Value * 10
end
end
if bs[4].Activated then
if p:WaitForChild("leaderstats"):WaitForChild("Taps").Value >= bs[4].Price.Value then
p:WaitForChild("leaderstats"):WaitForChild("Taps").Value -= bs[4].Price.Value
p:WaitForChild("leaderstats"):WaitForChild("Rebirths").Value += 10
p:WaitForChild("leaderstats"):WaitForChild("Gems").Value += bs[4].Price.Value * 10
end
end
if bs[5].Activated then
if p:WaitForChild("leaderstats"):WaitForChild("Taps").Value >= bs[5].Price.Value then
p:WaitForChild("leaderstats"):WaitForChild("Taps").Value -= bs[5].Price.Value
p:WaitForChild("leaderstats"):WaitForChild("Rebirths").Value += 50
p:WaitForChild("leaderstats"):WaitForChild("Gems").Value += bs[5].Price.Value * 10
end
end
end
Here is the code for the buttons
local rs = game:GetService("ReplicatedStorage")
local rffr = rs:WaitForChild("RebirthFrameFR")
script.Parent.Activated:Connect(function()
rfrfr:InvokeServer()
end)
Where did u get the rfrfr var in the button’s code? Or is it rffr misspelled? If it is the rffr var misspelled then try fix that, also, if u could send a picture of the explorer it will be great so we can help u better c:
Just like what @OPDNFLS said, check your button code for any misspelling that you may have missed. Also, I would suggest being less vague with your variable names (to make it easier to understand).
StarterGui is not usable in-game, you should use Player.PlayerGui.
For everyone’s overall sanity, and the reason this doesn’t work in the first place, NAME YOUR VARIABLES PROPERLY! I mean, you’ve misspelled the awful variable name you came up with.
rfrfr should be rffr. This would have been easier to notice if the variables were named properly, rather than just a bunch of random, incoherent letters.
There are various issues with your script, see the other comments.
You cannot see when a button has been activated directly from the server, this would need to be passed through RemoteEvents.
Basically what happens is your if statement finds the button, then it finds the button’s Activated property, which is an RBXScriptConnection and since it exists and is not false or nil the if statement runs and adds the currency, this then happens with the next… and the next.
Also, where did you made that when the rebirth is activated, the taps are multiplied by a certain value?
Look, ill try to guess what you’re trying to do since its not completely clear, please correct me if i have something wrong. Soooo, youre doing a rebirth system, so when the button1 is activated it searches into the player, then into the leaderstats, then into the taps, to see if the value of the taps is higher or equal to the price of the of the rebirth, and so if it does, then subtract the Taps value, set the rebirths value to 1 and sum rebirth cost * 10 to the gems value
The problem with this is that you said is that the taps per… tap (bruh) is never being multiplied, or at least not in this script, so you need something likeeee ehhh
if p:WaitForChild("leaderstats"):WaitForChild("Rebirths").Value >= p:WaitForChild("leaderstats"):WaitForChild("Taps").Value then
--code to set the tap value for 2 when the rebirth is higher or equal
--to the tap value, if you manage to make a tap per tap variable, make it multiply
--by itself so the next time this code runs (at the second rebirth) instead of being
--1x1 it would be 2x2, the thing is that this would make you need 4 rebirths to get to 8x tap
--but i actually like more that idea, it makes it harder to get a higher tap per tap
end
thats all i think, idk if you even have a variable for your tap per tap but if you dont u should make it, otherwise YOU CANT MAKE THE TAP COUNTER BE MORE THAN 1, i rlly hope this helps you, and if not maybe it would be better if you send me a message cause i think this responses are starting to be b i g