game.Players.PlayerAdded:Connect(function(player)
local stat = Instance.new("Folder", player)
stat.Name = "stats"
local money = Instance.new("IntValue")
money.Name = "Money"
money.Value = 0
money.Parent = player.stats
local Multiplayer = Instance.new("IntValue")
Multiplayer.Name = "Multi"
Multiplayer.Value = 1
Multiplayer.Parent = player.stats
while true do
task.wait(1)
money.Value += 1 * Multiplayer.Value
end
end)
upgrade button script:
local Player = game.Players.LocalPlayer
local Money = Player.stats:FindFirstChild("Money")
local Multi = Player.stats:FindFirstChild("Multi")
local ReplicatedStorage = game:WaitForChild("ReplicatedStorage")
local Remotes = ReplicatedStorage:WaitForChild("Remotes")
local Event = Remotes:WaitForChild("DoubleMoneyGainEvent")
local screenGUI = script.Parent
local GuiHolder = screenGUI.GuiHolder
local UpgradesHolder = GuiHolder.UpgradesHolder
local StatsHolder = GuiHolder.StatsHolder
local DoubleMoneyGainButton = UpgradesHolder.DoubleMoney.UpgradeButton
local function DoubleMoneyGain()
local NumberOfUpgrades = DoubleMoneyGainButton.NumberOfUpgrades
if NumberOfUpgrades.Value == 0 and Money.Value >= 5 then
Money.Value -= 5
Multi.Value *= 2
NumberOfUpgrades.Value += 1
Event:FireServer()
end
end
DoubleMoneyGainButton.MouseButton1Click:Connect(DoubleMoneyGain)
So whats working and whats not? (e.g is the money value increasing in leaderstats) because I cant really tell whats what like is “holder” supposed to be a text label or frame?
then its probably a problem with replicated storage?
im also new so im not 100% sure
Idk the reason for using :WaitForChild instead of :GetService because I’ve always used :GetService(“ReplicatedService”)
same thing for your remotes and events, I would just index them normally
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remotes = ReplicatedStorage.Remotes
local Event = Remotes.DoubleMoneyGainEvent
we can just code the logistics in the server script so change this to
local function DoubleMoneyGain()
local NumberOfUpgrades = DoubleMoneyGainButton.NumberOfUpgrades
NumberOfUpgrades.Value += 1
Event:FireServer()
end
end
then add the part we removed to the server script (add this to the top of the server script)
ok i almost got it im switched script from local to server
im just need to find where do i put MouseButton1Click and RemoteEvent
local ReplicatedStorage = game:WaitForChild("ReplicatedStorage")
local Remotes = ReplicatedStorage:WaitForChild("Remotes")
local RemoteEvent = Remotes:WaitForChild("DoubleMoneyGainEvent")
local screenGUI = script.Parent
local GuiHolder = screenGUI.GuiHolder
local UpgradesHolder = GuiHolder.UpgradesHolder
local StatsHolder = GuiHolder.StatsHolder
local DoubleMoneyGainButton = UpgradesHolder.DoubleMoney.UpgradeButton
--DoubleMoneyGainButton.MouseButton1Click:Connect(function(player)
local Money = player.stats:FindFirstChild("Money")
local Multi = player.stats:FindFirstChild("Multi")
local NumberOfUpgrades = DoubleMoneyGainButton.NumberOfUpgrades
if NumberOfUpgrades.Value == 0 and Money.Value >= 5 then
Money.Value -= 5
Multi.Value *= 2
NumberOfUpgrades.Value += 1
end
end)
--where do u need to put those?
--RemoteEvent:FireServer()
--DoubleMoneyGainButton.MouseButton1Click:Connect(function(player)
end
end)
nooooooooooooo
remote event is used to communicate between server and client scripts
idk why dev forum send the notification so late
I dont think you can access guis through server scripts so your new script wont work
you have to put this inside of the server script!!! thats what i said!!