Can someone help me on why is this script not working?
enableInteractions & playerInRange are both BoolValue
i can access and change playerInRange but can’t access or detect if the enableInteractions value is changed or not.
Thanks for the help in advance !
This in the PlayerCollideHandler (its a Script)
local collider = script.Parent
local npc = collider.Parent
local playerInRange = collider.playerInRange
local enableInteractions = npc.enableInteractions
local npcID = npc.npcID
local function onTouched()
if enableInteractions.Value then
playerInRange.Value = true
end
end
local function onTouchEnded()
playerInRange.Value = false
end
collider.Touched:Connect(onTouched)
collider.TouchEnded:Connect(onTouchEnded)
its a ‘BoolValue’ which is turned on and off but it isn’t affecting my script at all, like if its on, then it should change the playerInRange, which it does. But then turning it off in-game, it doesn’t stop affecting playerInRange.
When enableInteraction’s value is true as I start the game, it behaves like its true the whole time even if I turn it off in-between. It should stop turning playerInRange’s value to true if its turned off in-game, which is not happening.
For some reason this won’t work with bool values, try instead:
if enableInteractions == true then
It’s strange why you can’t access it using .Value can you try and change all code in the script which involves bool values to if boolvalue == true/false.