Hello all! So I am making a football game, and i want to make it to where when the person steps out of bounds WITH A FOOTBALL, it lights up red. I want to make a variable called HasBall, so where when you have the ball equipped and step out of bounds, that is only when it lights up red. Here is what i have so far.
local oob = script.Parent
local oobline = game.Workspace.OOBLIGHT
local ball = game.ServerStorage.Tools.Football
local LocalPlayer = game.Players.LocalPlayer
local HasBall =
local function onTouch(hit)
if (hit.Parent:findFirstChild("Humanoid") ~= nil) and HasBall then
oobline.Transparency = 0
wait(2.5)
oobline.Transparency = 1
end
end
script.Parent.Touched:connect(onTouch)
(oobline is neon red and currently has a transparency of 1)
Is the ball a tool?
If the ball is a tool, it will be in the Character.
So instead of “HasBall”, you can do:
local function onTouch(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil and hit.Parent:FindFirstChild('Football') ~= nil then
oobline.Transparency = 0
wait(2.5)
oobline.Transparency = 1
end
end
Yes, the ball is a tool, but it isn’t specifically “touching” the out of bounds line, the transparency changes when you have the tool equipped and touch the out of bounds line with your foot/humanoid