Please help me, my module script does not want to work properly, I made a Script in the ServerScriptService in which it detects if the RemoteEvent was triggered by the OnServerEvent , and then triggering the module script, it even works, but not in the way I expected, the idea is that when the main cloud finishes its rising animation, and the module’s script is activated, thus creating other clouds around the main cloud and then these clouds approach the position that the main cloud is. But when the main cloud finishes its animation and it comes time for the module’s script to create the other clouds, the clouds simply appear near the main cloud (or inside) and then go up instead of going to the main cloud’s position.
Here the Script
if Morian == "Start" and db == false then
db = true
local CreateCloudModule = require(script.StormMod)
local Value = script.Value.Value
local rv = game:GetService("ReplicatedStorage").FruitEvent.FruitModelClone.StormStormNoMi.Clouds.CloudModel:Clone()
local hb = game:GetService("ReplicatedStorage").FruitEvent.FruitModelClone.StormStormNoMi.Clouds.Cloud
rv.Parent = game.Workspace
local Goal2 = CFrame.new(0, 40, 0)
local Goal = CFrame.new(Player.Character.RightHand.Position)
local CF_value = Instance.new("CFrameValue")
CF_value.Changed:Connect(function(V)
rv:PivotTo(V)
end)
CF_value.Value = rv:GetPivot()
local Tween = game:GetService("TweenService"):Create(CF_value, TweenInfo.new(0.01), {Value = Goal})
Tween:Play()
task.wait(0.1)
local Tween2 = game:GetService("TweenService"):Create(CF_value, TweenInfo.new(3), {Value = Goal2}, Enum.EasingStyle.Cubic, false)
Tween2:Play()
task.wait(3)
while Value ~=20 do
Value +=1
task.wait(2)
local Model = CreateCloudModule.CreateStand(game.Workspace:WaitForChild("CloudModel"):WaitForChild("CloudMunicipe"), 2)
game.Debris:AddItem(Model,3)
end
if Value == 20 then
Value = 0
end
db = false
end
and here is the Module script, obs: the module script is inside of the Script
module.CreateStand = function(StartPosition, NumberOfPoints)
if db == false then
db = true
local Model = Instance.new("Model", game.Workspace.DebrisFolder)
Model.Name = "Stand"
local Points = {}
for i = 0,NumberOfPoints do
local OffSet = Vector3.new(math .random(-45, 45), 0, math .random(-45, 45))
if i == 0 or i == NumberOfPoints then
OffSet = Vector3.new(0,0,0)
end
local Part = RP.Clouds.Cloud:Clone()
Part.Parent = Model
Part.Size = Vector3.new(math .random(14, 16), math .random(9, 11), math .random(19, 21))
Part.Position = StartPosition.Position - OffSet
Points[#Points+1] = Part
task.wait()
local Info = TweenInfo.new( 3, Enum.EasingStyle.Cubic, Enum.EasingDirection.In, 0, false, 0)
local partPos = Part.Position
local Goals =
{
Position = partPos + StartPosition.Position
}
local movepartx = TweenService:Create(Part, Info, Goals)
movepartx:Play()
db = false
end
return Model
end
end
return module
Here is the video showing the behavior.
yuppp yess sirrr, my bad script always work different than i expect