Hello guys! I'm making a live event in which somewhen in it an orb explodes. I want to make it so when the orb explodes, you go flying backwards depending on where you are. I tried it with CFrames, creating relations between the orb and the HumanoidRootPart of the player, but it didn't work. Can anyone help me making a script to pull a player back from a part depending on where is he on the map? I made this script after some others. This is the latest version of it I made and still not working after trying everything. Thanks. view source
local ts = game:GetService("TweenService") local pa = script.Parent.HumanoidRootPart pa.Anchored = true local hum = script.Parent.Humanoid local ant = hum:LoadAnimation(hum.Parent.FlyAnimation) local ti = TweenInfo.new(2.5) local go = {} go.CFrame = CFrame.new(game.Workspace.Star.Trunce.Position,script.Parent.HumanoidRootPart.Position) + Vector3.new(0,2048*1.5,-2048*1.5) local tw = ts:Create(pa,ti,go) tw:Play() wait(0.5) ant:Play()
Solved my question. Simply made the HumanoidRootPart look the orb and then push it back with a CFrame, which is relative to the part.
script.Parent.HumanoidRootPart.CFrame = CFrame.new(script.Parent.HumanoidRootPart.CFrame.Position,game.Workspace.Star.Trunce.CFrame.Position) local ts = game:GetService("TweenService") local pa = script.Parent.HumanoidRootPart pa.Anchored = true local hum = script.Parent.Humanoid local ant = hum:LoadAnimation(hum.Parent.FlyAnimation) local ti = TweenInfo.new(2.5) local go = {} go.CFrame = script.Parent.HumanoidRootPart.CFrame * CFrame.new(0,2048*2,2048*2) local tw = ts:Create(pa,ti,go) tw:Play() wait(0.5) ant:Play()