Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

An explosion that pulls you back?

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()

1 comment

0

body force, tweening, I really hated coding it. pushing the user relative to a point...

1 answer

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()

This discussion is preserved as it was. New answers, comments, and votes are closed.