#nobody helped me last time please I'm trying to make light collisions

1 messages · Page 1 of 1 (latest)

azure turtle
#
  local Light = script.Parent
local counter = 0
local counter2 = 0
local ref = script.Parent.Parent.Ref
local function increaseHeight(part, amount, amount2)
    counter += 1
    amount2 = amount*counter
    local refo = script.Parent.Parent.Ref.CFrame
    part.Size += Vector3.new(0,amount,0)
    part.CFrame = refo+Vector3.new(0, 0, 0)
    part.CFrame *= CFrame.new(0,-amount2/2,0)
end 

local function decreaseHeight(part, amount, amount2)
    counter -= 1
    if counter < 0 then
        counter = counter* -1
        amount2 = amount*counter
        local refo = script.Parent.Parent.Ref.CFrame
        part.Size += Vector3.new(0,-amount,0)
        part.CFrame = refo+Vector3.new(0, 0, 0)
        part.CFrame *= CFrame.new(0,amount2/2,0)
    else
    amount2 = amount*counter
    local refo = script.Parent.Parent.Ref.CFrame
    part.Size += Vector3.new(0,-amount,0)
    part.CFrame = refo+Vector3.new(0, 0, 0)
    part.CFrame *= CFrame.new(0,amount2/2,0)
    end
    end
while task.wait() do
    local w = 0
    local a = 0
    local touchingparts = script.Parent:GetTouchingParts()
    if #touchingparts == 0 or Light.Size.Y < 33 or #touchingparts == 0 and Light.Size.Y < 33 then
    w = 1
    increaseHeight(Light, w, w)
    else
    w = 1
    decreaseHeight(Light, w, w)
    end
        end
#

ghost ping

#

of doom

#

ok

#

...

#

bro typing

hard crag
#

i got uuu

azure turtle
#

yipee

hard crag
#

do u want smth easy to js copy and paste? or should i edit ur script

azure turtle
#

uh

#

idk whatever works better

#

I thought the script would be simple

#

just a beam that grows, and then shrinks when it hits something

#

but

#

it's not because

#

the thing the beam is attached to moves

#

it has to move

#

so I have to use a reference part

hard crag
#

-- Script inside the "LT" Part
local triggerPart = script.Parent
local pointLight = triggerPart:FindFirstChildOfClass("PointLight")

-- Make sure the L starts off
pointLight.Enabled = false

-- T when a player touches the part
triggerPart.Touched:Connect(function(hit)
local character = hit.Parent
local humanoid = character and character:FindFirstChildOfClass("Humanoid")
if humanoid then
pointLight.Enabled = true
end
end)

-- Turn off the L when the player leaves the part
triggerPart.TouchEnded:Connect(function(hit)
local character = hit.Parent
local humanoid = character and character:FindFirstChildOfClass("Humanoid")
if humanoid then
pointLight.Enabled = false
end
end)

#

well this always helps for just simple light collisions

#

but what youre looking for might need a whole rewrite since the script should have been simple

azure turtle
#

hm

#

that's not quite what I meant

#

nvm I'll figure it out sorry