So I have a a LocalScript
that actives a RemoteFunctions
. That RemoteFunction
sets a BoolValue
within the LocalPlayer
to true, on the Server and Client.
These scripts are working perfectly fine ^
I have another script where if you click F on your keyboard it will check if
if debounce == false and BoolValue == true then
But even if that BoolValue
== true then script thinks its false and it says
"You need to Unlock the move"
local Player = game:GetService("Players").LocalPlayer local UIS = game:GetService("UserInputService") local Sounds = game:GetService("ServerScriptService") local Unlock = Player.Unlocks:WaitForChild("Magic: Raitoningu") local Unlocked = Unlock.Value local debounce = false local cooldown = 8 local rp = game:GetService("ReplicatedStorage") local RE = rp["Magic: Raitoningu"] function cameraShake() local Character = Player.Character local length = 10 for i = 1, length do Character.Humanoid.CameraOffset = Vector3.new(math.random(-1,1),math.random(-1,1),math.random(-1,1)) wait() end Character.Humanoid.CameraOffset = Vector3.new(0,0,0) end wait(1) UIS.InputBegan:Connect(function(input,isTyping) if isTyping then return elseif input.KeyCode == Enum.KeyCode.F then if Unlocked == false then print("You need to Unlock the move") end if debounce == true then print("Youre on Cooldown") end if debounce == false and Unlocked == true then debounce = true RE:FireServer() spawn(function() wait(.75) cameraShake() end) end end end) RE.OnClientEvent:Connect(function() wait(cooldown) debounce = false print("Magic: Raitoningu Ready") end)
Sorry if this post sucks, I havent posted in a while...
It would be easier to just fire the event and check if it's unlocked in the server script. This would prevent exploiters from spamming as well.