I trying to run this through a regular script: while script.Parent:FindFirstChild("Ability").Value == 1 do

print ("909")

wait(1)

end But it doesn't work. I have another script in a local script to test for a key being pressed and once that key is pressed it sets the value of the "Ability" to 1. Here's the code for that: tool.Equipped:Connect(function()

Mouse = game.Players.LocalPlayer:GetMouse()

tool = script.Parent

player = game.Players.LocalPlayer

value = script.Parent.Ability.Value

Mouse.KeyDown:connect(function(key)

if key:lower() == 'q' then

print('Player has used the button A.')

script.Parent.Ability.Value = 1

end

end)

end)

7 comments

0

Use the UserInputService instead of KeyDown. It's also client-sided.

0

Alright I'll try thanks

0

Remote event is what should be used for this

0

if it is filtering enabled. the local script cant change the value of ability.

0

The script that detects if ability is 1 only runs once since it is not a loop. It only checked the while once and that one time, it wasnt 1. A connect would be more applicable here though so just use a remote event and connect. Try a remote event that is fired by the client (RemoteEvent:FireServer) and a RemoteEvent.OnServerEvent:Connect(function).

0

@wwwdanielwww no

0

Thanks daniel, I'll try that.