Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Airdrop Keeps Spawning In Wrong Position?

Asked by 2 years ago

Hello I Have A Problem With My Airdropping System. Every time You Send In A Airdrop It Spawns In The Wrong Position. Help Anyone?

Airdrop Client

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local Equipped = false
local CanSelect = true
local CantPlace = false
local PartClone = game.ReplicatedStorage.AirdropFollowPart:Clone()
PartClone.Parent = workspace
script.Parent.Equipped:Connect(function()
    Equipped = true
end)

script.Parent.Unequipped:Connect(function()
    Equipped = false
end)

script.Parent.Activated:Connect(function()
    if CanSelect == true then
        if CantPlace == true then
            script.Parent.Handle.Sound:Play()
            CanSelect = false
            wait(2)
            workspace.Remotes.SendAirdrop:FireServer(mouse.Hit.X,mouse.Hit.Y,mouse.Hit.Z)
        end
    end
end)

while true do
    wait(0.0001)
    if Equipped == true then
        PartClone.Transparency = 0.5
        PartClone.CFrame = mouse.Hit
        PartClone.CanCollide = false
        PartClone.Orientation = Vector3.new(0,0,-90)
        local mag = math.abs(math.floor((script.Parent.Handle.Position - PartClone.Position).Magnitude))
        if CanSelect == false then
            PartClone:Destroy()
        end
        if mouse.Target == nil then
            PartClone.Color = Color3.new(1, 0, 0)
            CantPlace = false
        else
            PartClone.Color = Color3.new(0, 1, 0)
            CantPlace = true
        end
        if mag > 50 then
            PartClone.Color = Color3.new(1, 0, 0)
            CantPlace = true
        end
    end
end

Airdrop Server.

workspace.Remotes.SendAirdrop.OnServerEvent:Connect(function(posX,posY,posZ)
    local AirdropModel = game.ServerStorage.AirdropModel:Clone()
    AirdropModel.Parent = workspace
    print("Spawned In!")
    AirdropModel:SetPrimaryPartCFrame(CFrame.new(Vector3.new(posX,posY,posZ)))
    AirdropModel.BodyVelocity.Parent = AirdropModel.Parachute
end)

Also Its Been About A Year Since I've Been Here! idk why anybody would care about that but ok.

Answer this question