-The script is inside a part in the Workspace -When it is touched the below script activates -It works perfectly in studio but not in game, any ideas ?

local debounce = false
local debounce2 = false

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DropBallClientEvent = Instance.new("RemoteEvent", ReplicatedStorage)
DropBallClientEvent.Name = "DropBallClientEvent"

script.Parent.Touched:connect(function(hit)
	if debounce2 == true then return end
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
		debounce2 = true
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		if player.Team == game.Teams["-Home GK"] then
			if player.Backpack.LocalVariables:WaitForChild("ObjectHeld").Value ~= nil then
		DropBallClientEvent:FireClient(player)
	end
		end
		end
wait(1)
debounce2 = false
end)

4 comments

0

Line 8, change connect toConnect.

0

lowercase connect still works tho, that's hardly the issue ?

0

Deprecated code can cause problems.

0

My entire game works on deprecated code then oh noes, but that wasn't the problem it was with player.Team in line 13, I really appreciate the response though thank you so much.