Lua - это мощный скриптовый язык,
Через lua можно менять мир Roblox.
Можно создать игру со своим сценарием.
Lua - это мощный скриптовый язык,
Через lua можно менять мир Roblox.
Можно создать игру со своим сценарием.
Создайте элементы пользовательского интерфейса согласнно рисунку 3:
game.Players.PlayerAdded:Connect(function(plr)
print("0K")
local CashStats = Instance.new("Folder",plr)
CashStats.Name = "CashStats"
local cash = Instance.new("NumberValue",CashStats)
cash.Name = 'Cash'
cash.Value = 500
local answer = Instance.new("NumberValue",CashStats)
answer.Name = 'answer'
answer.Value = 10000
local time = Instance.new("NumberValue",CashStats)
answer.Name = 'time'
answer.Value = 100
end)
game.ReplicatedStorage.RemoteEventAnswer.OnServerEvent:Connect(function(plr)
plr.CashStats.Cash.Value = plr.CashStats.Cash.Value + 100
end)
Обратите внимание, что тип скрипта - серверный, все другие будут выполняться на клиенте.
-- Создание события по клику на кнопке
script.Parent.Size = UDim2.new(0.05, 0, 0.10, 0)
script.Parent.MouseButton1Click:Connect(function()
local newPositionX = math.random(0, 80) / 100
local newPositionY = math.random(0, 80) / 100
script.Parent.Position = UDim2.new(newPositionX, 0, newPositionY, 0)
game.ReplicatedStorage.RemoteEventAnswer:FireServer()
end)
--обновляем время
while wait(0.1) do
script.Parent.Text = game.Players.LocalPlayer.CashStats.time.Value
game.Players.LocalPlayer.CashStats.time.Value = game.Players.LocalPlayer.CashStats.time.Value - 5
if game.Players.LocalPlayer.CashStats.time.Value <= 0 then
local newPositionX = math.random(0, 80) / 100
local newPositionY = math.random(0, 80) / 100
script.Parent.Position = UDim2.new(newPositionX, 0, newPositionY, 0)
game.Players.LocalPlayer.CashStats.time.Value = 100
end
end
--создаем кнопку закрытия окна
local plr = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
plr.PlayerGui.ScreenGui_osu.Frame_osu.Visible = false
plr.PlayerGui.ScreenGui_menu.Enabled = true
plr.PlayerGui.ShopGui.Enabled = true
end)
--обновление очков
while wait(0.01) do
script.Parent.Text = game.Players.LocalPlayer.CashStats.Cash.Value.." $"
end