Using this, I got the 4 balloons to spawn and get randomly assigned a color. But now they only seem to move on the Y and Z Axis’s and not the X Axis. (This script is calling for gamemode detection so you’ll have to cut that part out for it to work for you)
local modeswitch = game.ReplicatedStorage.Gamemode.Value
if modeswitch == 2 then
local LimitBox = script.Parent
local BounariesX = LimitBox.Size.X
local BounariesY = LimitBox.Size.Y
local BounariesZ = LimitBox.Size.Z
local rng1 = math.random(1,4)
local rng2 = math.random(1,4)
local rng3 = math.random(1,4)
local rng4 = math.random(1,4)
local Tweens = game:GetService("TweenService")
local Cloud -- the cloud part, if the cloud is a model then you'd better off using runservice and :PivotTo()
--Balloon Config
--Balloon 1
local Balloon1 = Instance.new("Part")
local boardgui = Instance.new("BillboardGui")
boardgui.Size = UDim2.new(10,0,10,0)
boardgui.Parent = Balloon1
local spray = Instance.new("ImageLabel")
spray.BackgroundTransparency = 1
spray.Size = UDim2.new(1.25,0,1.25,0)
if rng1 == 1 then
spray.Image = 'http://www.roblox.com/asset/?id=18665545469' -- Blue Balloon
elseif rng1 == 2 then
spray.Image = 'http://www.roblox.com/asset/?id=18665545039' -- Green Balloon
elseif rng1 == 3 then
spray.Image = 'http://www.roblox.com/asset/?id=18665545173' -- Orange Balloon
elseif rng1 == 4 then
spray.Image = 'http://www.roblox.com/asset/?id=18665545294' -- Purple Balloon
end
spray.Parent = boardgui
spray.ResampleMode = Enum.ResamplerMode.Pixelated
Balloon1.Name = "Balloon1"
Balloon1.Transparency = .5
Balloon1.Color = Color3.new(1, 0, 0.0156863)
Balloon1.Parent = workspace.BalloonArea
Balloon1.Position = script.Parent.Position + Vector3.new(0,0,0)
Balloon1.Size = Vector3.new(1, 1, 1)
Balloon1.CanCollide = false
Balloon1.Anchored = true
--Balloon 2
local Balloon2 = Instance.new("Part")
local boardgui = Instance.new("BillboardGui")
boardgui.Size = UDim2.new(10,0,10,0)
boardgui.Parent = Balloon2
local spray = Instance.new("ImageLabel")
spray.BackgroundTransparency = 1
spray.Size = UDim2.new(1.25,0,1.25,0)
if rng2 == 1 then
spray.Image = 'http://www.roblox.com/asset/?id=18665545469' -- Blue Balloon
elseif rng2 == 2 then
spray.Image = 'http://www.roblox.com/asset/?id=18665545039' -- Green Balloon
elseif rng2 == 3 then
spray.Image = 'http://www.roblox.com/asset/?id=18665545173' -- Orange Balloon
elseif rng2 == 4 then
spray.Image = 'http://www.roblox.com/asset/?id=18665545294' -- Purple Balloon
end
spray.Parent = boardgui
spray.ResampleMode = Enum.ResamplerMode.Pixelated
Balloon2.Name = "Balloon2"
Balloon2.Transparency = .5
Balloon2.Color = Color3.new(1, 0, 0.0156863)
Balloon2.Parent = workspace.BalloonArea
Balloon2.Position = script.Parent.Position + Vector3.new(0,0,0)
Balloon2.Size = Vector3.new(1, 1, 1)
Balloon2.CanCollide = false
Balloon2.Anchored = true
--Balloon 3
local Balloon3 = Instance.new("Part")
local boardgui = Instance.new("BillboardGui")
boardgui.Size = UDim2.new(10,0,10,0)
boardgui.Parent = Balloon3
local spray = Instance.new("ImageLabel")
spray.BackgroundTransparency = 1
spray.Size = UDim2.new(1.25,0,1.25,0)
if rng3 == 1 then
spray.Image = 'http://www.roblox.com/asset/?id=18665545469' -- Blue Balloon
elseif rng3 == 2 then
spray.Image = 'http://www.roblox.com/asset/?id=18665545039' -- Green Balloon
elseif rng3 == 3 then
spray.Image = 'http://www.roblox.com/asset/?id=18665545173' -- Orange Balloon
elseif rng3 == 4 then
spray.Image = 'http://www.roblox.com/asset/?id=18665545294' -- Purple Balloon
end
spray.Parent = boardgui
spray.ResampleMode = Enum.ResamplerMode.Pixelated
Balloon3.Name = "Balloon3"
Balloon3.Transparency = .5
Balloon3.Color = Color3.new(1, 0, 0.0156863)
Balloon3.Parent = workspace.BalloonArea
Balloon3.Position = script.Parent.Position + Vector3.new(0,0,0)
Balloon3.Size = Vector3.new(1, 1, 1)
Balloon3.CanCollide = false
Balloon3.Anchored = true
--Balloon 4
local Balloon4 = Instance.new("Part")
local boardgui = Instance.new("BillboardGui")
boardgui.Size = UDim2.new(10,0,10,0)
boardgui.Parent = Balloon4
local spray = Instance.new("ImageLabel")
spray.BackgroundTransparency = 1
spray.Size = UDim2.new(1.25,0,1.25,0)
if rng4 == 1 then
spray.Image = 'http://www.roblox.com/asset/?id=18665545469' -- Blue Balloon
elseif rng4 == 2 then
spray.Image = 'http://www.roblox.com/asset/?id=18665545039' -- Green Balloon
elseif rng4 == 3 then
spray.Image = 'http://www.roblox.com/asset/?id=18665545173' -- Orange Balloon
elseif rng4 == 4 then
spray.Image = 'http://www.roblox.com/asset/?id=18665545294' -- Purple Balloon
end
spray.Parent = boardgui
spray.ResampleMode = Enum.ResamplerMode.Pixelated
Balloon4.Name = "Balloon4"
Balloon4.Transparency = .5
Balloon4.Color = Color3.new(1, 0, 0.0156863)
Balloon4.Parent = workspace.BalloonArea
Balloon4.Position = script.Parent.Position + Vector3.new(0,0,0)
Balloon4.Size = Vector3.new(1, 1, 1)
Balloon4.CanCollide = false
Balloon4.Anchored = true
--"Animation" Tweening
local function CloudTween()
local tween = Tweens:Create(Balloon1, TweenInfo.new(30, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out), {CFrame = CFrame.new(LimitBox.CFrame.X + LimitBox.CFrame.LookVector.X * math.random(-LimitBox.Size.X/2,LimitBox.Size.X/2), 10, LimitBox.CFrame.Z + LimitBox.CFrame.LookVector.Z * math.random(-LimitBox.Size.Z/2,LimitBox.Size.Z/2))})
local tween2 = Tweens:Create(Balloon2, TweenInfo.new(30, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out), {CFrame = CFrame.new(LimitBox.CFrame.X + LimitBox.CFrame.LookVector.X * math.random(-LimitBox.Size.X/4,LimitBox.Size.X/6), 10, LimitBox.CFrame.Z + LimitBox.CFrame.LookVector.Z * math.random(-LimitBox.Size.Z/4,LimitBox.Size.Z/6))})
local tween3 = Tweens:Create(Balloon3, TweenInfo.new(30, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out), {CFrame = CFrame.new(LimitBox.CFrame.X + LimitBox.CFrame.LookVector.X * math.random(-LimitBox.Size.X/6,LimitBox.Size.X/8), 10, LimitBox.CFrame.Z + LimitBox.CFrame.LookVector.Z * math.random(-LimitBox.Size.Z/6,LimitBox.Size.Z/8))})
local tween4 = Tweens:Create(Balloon4, TweenInfo.new(30, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out), {CFrame = CFrame.new(LimitBox.CFrame.X + LimitBox.CFrame.LookVector.X * math.random(-LimitBox.Size.X/8,LimitBox.Size.X/4), 10, LimitBox.CFrame.Z + LimitBox.CFrame.LookVector.Z * math.random(-LimitBox.Size.Z/8,LimitBox.Size.Z/4))})
tween:Play()
tween2:Play()
tween3:Play()
tween4:Play()
return
end
--repeat indefinitely
local function PlayTween()
local tween = CloudTween()
tween.Completed:Connect(PlayTween)
local tween2 = CloudTween()
tween2.Completed:Connect(PlayTween)
local tween3 = CloudTween()
tween3.Completed:Connect(PlayTween)
local tween4 = CloudTween()
tween4.Completed:Connect(PlayTween)
end
PlayTween() --start the loop
end