local Tool = script.Parent
local vChar = nil
local torso = nil
local maxRange = 100
local lowerBound = nil
local upperBound = nil
local debris = game:GetService("Debris")
local r = game:GetService("RunService")
local blinkSound = Tool.Blink
function onEquipped()
torso = nil
vChar = Tool.Parent
if vChar ~= nil then
torso = vChar:FindFirstChild("Torso")
end
end
Tool.Enabled = true
function getAABB()
local torsoXAxis = torso.CFrame:vectorToWorldSpace(Vector3.new(1, 0, 0)).unit
local torsoYAxis = torso.CFrame:vectorToWorldSpace(Vector3.new(0, 1, 0)).unit
local torsoZAxis = torso.CFrame:vectorToWorldSpace(Vector3.new(0, 0, 1)).unit
lowerBound = nil
upperBound = nil
-- create bounding box for blinking
charChildren = vChar:GetChildren()
for i = 1, #charChildren do
local handle = nil
if charChildren[i].className == "Hat" or charChildren[i].className == "Tool" then
handle = charChildren[i]:FindFirstChild("Handle")
elseif charChildren[i].className == "Part" then
handle = charChildren[i]
end
if handle ~= nil then
lowCornerTC = handle.CFrame:vectorToWorldSpace(-handle.Size / 2) + handle.Position - torso.Position
highCornerTC = handle.CFrame:vectorToWorldSpace(handle.Size / 2) + handle.Position - torso.Position
if lowerBound == nil then lowerBound = lowCornerTC end
if upperBound == nil then upperBound = highCornerTC end
lowerBound = Vector3.new(math.min(lowerBound.X, lowCornerTC.X), math.min(lowerBound.Y, lowCornerTC.Y), math.min(lowerBound.Z, lowCornerTC.Z))
upperBound = Vector3.new(math.max(upperBound.X, lowCornerTC.X), math.max(upperBound.Y, lowCornerTC.Y), math.max(upperBound.Z, lowCornerTC.Z))
lowerBound = Vector3.new(math.min(lowerBound.X, highCornerTC.X), math.min(lowerBound.Y, highCornerTC.Y), math.min(lowerBound.Z, highCornerTC.Z))
upperBound = Vector3.new(math.max(upperBound.X, highCornerTC.X), math.max(upperBound.Y, highCornerTC.Y), math.max(upperBound.Z, highCornerTC.Z))
end
end
end
function onActivated()
if not Tool.Enabled then return end
if torso == nil or vChar == nil then return end
local head = vChar:FindFirstChild("Head")
if head then
local torsoPos = torso.Position
local headPos = head.Position
hum = vChar:FindFirstChild("Humanoid")
if hum == nil then return end
Tool.Enabled = false
getAABB()
print(lowerBound)
print(upperBound)
hum.WalkSpeed = 0
--hum.Jump = true
01 | local newBG = torso:FindFirstChild( "TinyFloat" ) |
03 | newBG = Instance.new( "BodyPosition" ) |
04 | newBG.position = torso.Position + Vector 3. new( 0 , 0.5 , 0 ) |
06 | newBG.maxForce = Vector 3. new( 0 , newBG.P, 0 ) |
07 | newBG.Name = "TinyFloat" |
12 | local teleportSpot = hum.TargetPoint * Vector 3. new( 1 , 0 , 1 ) + Vector 3. new( 0 , headPos.Y, 0 ) |
13 | local teleportDir = (teleportSpot - headPos).unit |
16 | local charWidth = upperBound.Z - lowerBound.Z |
17 | local teleRise = upperBound.Y - lowerBound.Y |
20 | tY = Vector 3. new( 0 , 1 , 0 ) |
21 | tX = tZ:Cross(tY).unit |
24 | local smoker = Instance.new( "Part" ) |
25 | smoker.Name = "NinjaSmoke" |
26 | smoker.Transparency = 1 |
27 | smoker.CanCollide = false |
28 | smoker.Anchored = true |
29 | smoker.CFrame = torso.CFrame - Vector 3. new( 0 , 4 , 0 ) |
30 | smoker.Parent = game.Workspace |
32 | local smoke = Instance.new( "Smoke" ) |
34 | smoke.Color = Color 3. new( 5 , 0 , 5 ) |
36 | smoke.RiseVelocity = 2 |
39 | local smoke 2 = Instance.new( "Smoke" ) |
40 | smoke 2. Name = "smoke2" |
41 | smoke 2. Color = Color 3. new( 5 , 0 , 5 ) |
43 | smoke 2. RiseVelocity = 3 |
44 | smoke 2. Parent = smoker |
46 | local collision = false |
48 | for i = maxRange, charWidth, -charWidth do |
49 | teleportSpot = torsoPos + i*teleportDir |
50 | parts = game.Workspace:FindPartsInRegion 3 (Region 3. new(teleportSpot+lowerBound, teleportSpot+upperBound), vChar, 100 ) |
53 | if parts [ p ] ~ = nil and parts [ p ] .CanCollide then collision = true break end |
59 | if newBG ~ = nil then newBG:remove() end |
60 | torso.CFrame = CFrame.new(teleportSpot, teleportSpot+tZ) |
66 | teleportSpot = teleportSpot + Vector 3. new( 0 , teleRise, 0 ) |
67 | parts = game.Workspace:FindPartsInRegion 3 (Region 3. new(teleportSpot+lowerBound, teleportSpot+upperBound), vChar, 100 ) |
70 | if parts [ p ] ~ = nil and parts [ p ] .CanCollide then collision = true break end |
76 | if newBG ~ = nil then newBG:remove() end |
77 | torso.CFrame = CFrame.new(teleportSpot, teleportSpot+tZ) |
82 | smoker.smoke.RiseVelocity = . 5 |
83 | smoker.smoke 2. RiseVelocity = . 75 |
87 | if newBG ~ = nil then newBG:remove() end |
end
Tool.Equipped:connect(onEquipped)
Tool.Activated:connect(onActivated)
Where would I change the script to make the color green?
Please send me updated script and how you did it so I can learn... thanks a ton!!!