Script 1:
--Create Shop Boat GUI
local ShopFrame = Instance.new("Frame")
ShopFrame.Name = "ShopFrame"
ShopFrame.Size = UDim2.new(0.5, 0, 0.5, 0)
ShopFrame.Position = UDim2.new(0.25, 0, 0.25, 0)
ShopFrame.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2)
ShopFrame.Parent = game.Players.LocalPlayer.PlayerGui
--Create ViewportFrame for Boat Image
local BoatViewport = Instance.new("ViewportFrame")
BoatViewport.Name = "BoatViewport"
BoatViewport.Size = UDim2.new(0.4, 0, 0.6, 0)
BoatViewport.Position = UDim2.new(0.05, 0, 0.2, 0)
BoatViewport.BackgroundTransparency = 0
BoatViewport.BorderSizePixel = 2
BoatViewport.BorderColor3 = Color3.new(1, 1, 1)
BoatViewport.Parent = ShopFrame
--Create Camera
local BoatCamera = Instance.new("Camera")
BoatCamera.Name = "BoatCamera"
BoatCamera.CFrame = CFrame.new(Vector3.new(0, 10, -20), Vector3.new(0, 2, 0))
BoatCamera.Parent = BoatViewport
--Create Replicated Storage for Boats
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Boats = ReplicatedStorage:WaitForChild("Boats")
--Create Buy Button
local BuyButton = Instance.new("TextButton")
BuyButton.Name = "BuyButton"
BuyButton.Size = UDim2.new(0.4, 0, 0.2, 0)
BuyButton.Position = UDim2.new(0.5, 0, 0.8, 0)
BuyButton.BackgroundColor3 = Color3.new(1, 0.8, 0.4)
BuyButton.Font = Enum.Font.ArialBold
BuyButton.Text = "Buy for $"
BuyButton.TextColor3 = Color3.new(0, 0, 0)
BuyButton.Parent = ShopFrame
--Create Speed Value and Name for Boat
local BoatName = Instance.new("TextBox")
BoatName.Name = "BoatName"
BoatName.Size = UDim2.new(0.2, 0, 0.1, 0)
BoatName.Position = UDim2.new(0.55, 0, 0.15, 0)
BoatName.BackgroundColor3 = Color3.new(1, 1, 1)
BoatName.Font = Enum.Font.ArialBold
BoatName.Text = "Boat Name"
BoatName.TextColor3 = Color3.new(0, 0, 0)
BoatName.Parent = ShopFrame
local BoatSpeed = Instance.new("TextBox")
BoatSpeed.Name = "BoatSpeed"
BoatSpeed.Size = UDim2.new(0.2, 0, 0.1, 0)
BoatSpeed.Position = UDim2.new(0.55, 0, 0.3, 0)
BoatSpeed.BackgroundColor3 = Color3.new(1, 1, 1)
BoatSpeed.Font = Enum.Font.ArialBold
BoatSpeed.Text = "Boat Speed"
BoatSpeed.TextColor3 = Color3.new(0, 0, 0)
BoatSpeed.Parent = ShopFrame
--Create Cost Label for Boat
local CostLabel = Instance.new("TextLabel")
CostLabel.Name = "CostLabel"
CostLabel.Size = UDim2.new(0.1, 0, 0.2, 0)
CostLabel.Position = UDim2.new(0.9, 0, 0.8, 0)
CostLabel.BackgroundColor3 = Color3.new(1, 1, 1)
CostLabel.Font = Enum.Font.ArialBold
CostLabel.Text = "0"
CostLabel.TextColor3 = Color3.new(0, 0, 0)
CostLabel.Parent = ShopFrame
--Create Remote Event for Boat Purchase
local BuyBoat = ReplicatedStorage:WaitForChild("BuyBoat")
--Connect Buy Button to BuyBoat Remote Event
BuyButton.MouseButton1Click:Connect(function()
local BoatSpeedValue = tonumber(BoatSpeed.Text)
local BoatNameValue = BoatName.Text
local BoatCost = tonumber(CostLabel.Text)
BuyBoat:FireServer(BoatNameValue, BoatSpeedValue, BoatCost)
end)
Script 2:
--Create Gui for Spawn Boat
local SpawnBoatGui = Instance.new("ScreenGui")
SpawnBoatGui.Name = "SpawnBoatGui"
SpawnBoatGui.Parent = game.Players.LocalPlayer.PlayerGui
--Create Spawn Button
local SpawnBoatButton = Instance.new("TextButton")
SpawnBoatButton.Name = "SpawnBoatButton"
SpawnBoatButton.Size = UDim2.new(0.2, 0, 0.1, 0)
SpawnBoatButton.Position = UDim2.new(0.3, 0, 0.6, 0)
SpawnBoatButton.BackgroundColor3 = Color3.new(0.4, 0.4, 0.4)
SpawnBoatButton.Font = Enum.Font.ArialBold
SpawnBoatButton.Text = "Spawn Boat"
SpawnBoatButton.TextColor3 = Color3.new(1, 1, 1)
SpawnBoatButton.Parent = SpawnBoatGui
--Create ViewportFrame for Boat Image and Camera
local BoatViewport = Instance.new("ViewportFrame")
BoatViewport.Name = "BoatViewport"
BoatViewport.Size = UDim2.new(0.4, 0, 0.6, 0)
BoatViewport.Position = UDim2.new(0.05, 0, 0.2, 0)
BoatViewport.BackgroundTransparency = 0
BoatViewport.BorderSizePixel = 2
BoatViewport.BorderColor3 = Color3.new(1, 1, 1)
BoatViewport.Parent = SpawnBoatGui
--Create Camera
local BoatCamera = Instance.new("Camera")
BoatCamera.Name = "BoatCamera"
BoatCamera.CFrame = CFrame.new(Vector3.new(0, 10, -20), Vector3.new(0, 2, 0))
BoatCamera.Parent = BoatViewport
--Create Remote Event for Boat Spawn
local SpawnBoat = game.ReplicatedStorage:WaitForChild("SpawnBoat")
--Connect Spawn Button to SpawnBoat Remote Event
SpawnBoatButton.MouseButton1Click:Connect(function()
SpawnBoat:FireServer()
end)
--Create Remote Function for Showing Boat Image
local ShowBoatImage = game.ReplicatedStorage:WaitForChild("ShowBoatImage")
--Connect ShowBoatImage Remote Function to BoatViewport
ShowBoatImage.OnClientInvoke = function(BoatModel)
BoatModel.Parent = BoatViewport
BoatModel:SetPrimaryPartCFrame(CFrame.new(Vector3.new(0, 0, 0), Vector3.new(1, 0, 0)))
end)