Hello everyone, I’m making a conversion system(3 TimeValue = 1 StageCoins). But I don’t know how to make the system that is written in brackets. If anything I use ProfileService. I will be grateful for your help. Here are my scripts:
local TimeValueChange = game.ReplicatedStorage:WaitForChild("TimeValueChange2")
local ServerScriptService = game:GetService("ServerScriptService")
local PlayerData = require(ServerScriptService.PlayerData:WaitForChild("Manager"))
TimeValueChange.OnServerEvent:Connect(function(player, amount)
local profile = PlayerData.Profiles[player]
if not profile then return end
if player.TimeFolder.TimeValue.Value >= tonumber(amount) then
player.TimeFolder.TimeValue.Value = player.TimeFolder.TimeValue.Value - amount
player.StatsFolder.StageCoinsValue.Value = player.StatsFolder.StageCoinsValue.Value + amount
profile.Data.StageCoinsValue += amount
end
end)
local ConvertFrame = script.Parent:WaitForChild("ConvertFrame")
local TextBoxConvert = ConvertFrame:WaitForChild("TextBoxConvert")
local FinallyValue = ConvertFrame:WaitForChild("FinallyValue")
local ButtonConvert = ConvertFrame:WaitForChild("ConvertButton")
local player = game.Players.LocalPlayer
local TimeStats = player.TimeFolder:WaitForChild("TimeValue")
local TimeChange = game.ReplicatedStorage:WaitForChild("TimeValueChange2")
TextBoxConvert.Focused:Connect(function()
TextBoxConvert:GetPropertyChangedSignal("Text"):Connect(function()
FinallyValue.Text = TextBoxConvert.Text:gsub("%D+", "")
end)
end)
ButtonConvert.MouseButton1Click:Connect(function()
local text = TextBoxConvert.Text
TimeChange:FireServer(text)
end)