BoolValue not working

So I’m making a fishing game and I want that when I press “E” with UserInputService it activates the boolvalue.
But when I press “E” it doesn’t activate the boolvalue.

My script and boolvalue are in the StarterPlayerScripts
image

I tried looking in the DevForum but I didn’t find anything useful and tried messing around but nothing worked.

wait()

local Animation = script.Throw
local Plr = game.Players.LocalPlayer
local Char = Plr.Character
local Rod = Char.RightHand.Rod
local UIS = game:GetService("UserInputService")
local AnimationTrack = Char.Humanoid:LoadAnimation(Animation)
local ReelPose = script.ReelPose
local ReelPoseTrack = Char.Humanoid:LoadAnimation(ReelPose)
local Reel = script.Reel
local ReelTrack = Char.Humanoid:LoadAnimation(Reel)
local IsFishing = script.IsFishing

	local function FishFunction()
	AnimationTrack:Play()
	wait(1)
	ReelPoseTrack:Play()
	end

if IsFishing.Value == false then
	UIS.InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.E then
			IsFishing.Value = true
			print(IsFishing)
			FishFunction()
			for i = 1,3 do
				print(i)
				wait(1)
				ReelTrack:Play()
			end
			wait(3)
			IsFishing.Value = false
		end
	end)
end

I hope you can help me!

1 Like

Having this only checks once. What you can do instead is use GetPropertyChangedSignal, which will fire when the value is changed

IsFishing:GetPropertyChangedSignal('Value'):Connect(function()
    if IsFishing.Value == false then
        -- continue with code
    end
end)
3 Likes

The problem is that you are changing it in a local script which doesn’t change it for the server which makes the script think that it is still the same. Try using RemoteEvents or RemoteFunctions to tell the server to change the value.

2 Likes

I don’t know how to use them.
but I’m looking to tutorials how to use them.

Do remoteEvent:FireServer(bool name) in the local script, then in a server script do ```

remoteEvent.OnServerEvent:Connect(function(plr, boolValue)
    --change the bool value here
end)
1 Like

Yes! Thank you so so much it works!

1 Like