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

Getting this morph to work?

Asked by 9 years ago

Ok so I have this script that basically makes this huge model appear behind you but I keep running into a couple problems. Firstly the model appears where your torso was but you get launched 200-300 studs in a random position, also you occasionaly get pushed under the map and once the Welds get delted you fall to your death, How can I fix this?

Side Note:I know this script is very sloppy, I was in that try anything to get this to work stage

wait(2)
local bin = script.Parent
local Player = game.Players.LocalPlayer
local mouse = Player:GetMouse()
local c = Player.Character

enabled = true


function onButton1Down(mouse)
    if not enabled then return end
    local player = game.Players.LocalPlayer
    if player == true then return end
    print("trigger")
    -- find the best cf

enabled = false
game:GetService("Chat"):Chat(c.Head, "Saiken!!!")
C=c.Torso.CFrame
wait(0.001)
local B1 = script.Parent.Saiken:Clone()
local B2 = B1:GetChildren()
B1.Parent = game.Workspace




B1.Name = ("6 Tail")
B1.PrimaryPart = B1.Chest
B1:SetPrimaryPartCFrame(C*CFrame.new(0, 0, 30))
for i = 1, #B2 do
game.Players.LocalPlayer.Character.HumanoidRootPart.Anchored = true   
W1 = Instance.new("Weld")
   W1.Parent = B2[i]
   W1.Part0 = game.Players.LocalPlayer.Character.HumanoidRootPart
   W1.Part1 = B2[i]
   W1.C0 = C*B2[i].CFrame

game.Players.LocalPlayer.Character.HumanoidRootPart.Anchored = false
game:GetService("Debris"):AddItem(W1, 19.9)
end

wait(1)

game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 100
game:GetService("Debris"):AddItem(B1, 20)
wait(25)
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16

enabled = true
end

function onSelected(mouse)
    print("select")
    mouse.Icon = "rbxasset://textures\\GunCursor.png"
    mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end

bin.Selected:connect(onSelected)

2 answers

Log in to vote
0
Answered by 9 years ago

I'm on my mobile so I cant test this, but all you need to do is make an offset for the model so it spawns behind the character.

Just add this to the model's position before spawning it in: C:vectorToWorldSpace(Vector3.new(0,0,20))

Ad
Log in to vote
0
Answered by 9 years ago

Didn't work :(

Answer this question