Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is there a way to test for an IntValue in a regular script?

Asked by 5 years ago

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)

0
Use the UserInputService instead of KeyDown. It's also client-sided. DeceptiveCaster 3761 — 5y
0
Alright I'll try thanks BigHeavyPantsBoi 0 — 5y
0
Remote event is what should be used for this wwwdanielwww 5 — 5y
0
if it is filtering enabled. the local script cant change the value of ability. wwwdanielwww 5 — 5y
View all comments (3 more)
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). wwwdanielwww 5 — 5y
0
@wwwdanielwww no DeceptiveCaster 3761 — 5y
0
Thanks daniel, I'll try that. BigHeavyPantsBoi 0 — 5y

Answer this question