So I'm trying to pass the variable player down to the code below the giveWeapon function. I'm not having any luck and the tutorials I have watched are not helping me much either and how would I go about passing the hit parameter down from the giveWeapon function to the function below as well?
local playersPlaneHitBox = game.ReplicatedStorage.planeHitBox
local rockets = game.ReplicatedStorage.PlaneRocket
local debounce = true
local sitCheck = false
local function giveWeapon(hit)
local player = hit.Parent:FindFirstChild("Humanoid") ---Need to pass this variable down
if player then
if player.Sit == true then
if not hit.Parent:FindFirstChild("PlaneRocket")then
local clonedRocket = rockets:Clone()
clonedRocket.Parent = hit.Parent
print("test")
sitCheck = true
end
end
end
return player
end
script.Parent.Touched:Connect(giveWeapon)
if player.Sit == false then ---I want to pass the player variable here
if sitCheck == true then
local clonePlaneHitBox = playersPlaneHitBox:Clone() ---I also want to pass the hit parameter here
clonePlaneHitBox.Parent = game.Workspace
clonePlaneHitBox.CFrame = hit.Parent.HumanoidRootPart.CFrame
end
end
player()

3 comments
to where are you passing it?
what line you passing it to?
22