I'm making a script where if a player, or object touches it, it will set the "G" value to true. When I touch it in play mode, and I try it with the print command, it comes out as false. I want to be true, but it doesn't work!

Code:

local SP = script.Parent

function Check()
SP.G.Value = true
end

function UnCheck()
SP.G.Value = false
end

SP.Touched:connect(Check)
SP.TouchEnded:connect(UnCheck)