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

Help with UserInputService? It's also a LocalScript.

Asked by
NykoVania 231 Moderation Voter
2 years ago
Edited 2 years ago

There is a folder in the Character named LocalConditions with 2 BoolValues, Forward and Back. Forward is supposed to be set to true when W is being held and set to False when let go, neither values get set to true or change, any help?

Edit: There are no errors in output

01local Player = game.Players.LocalPlayer
02local Char = Player.Character
03local uis = game:GetService("UserInputService")
04uis.InputBegan:connect(function(input)
05    if input.KeyCode == Enum.KeyCode.W then
06        Char["LocalConditions"]:FindFirstChild("Forward").Value = true
07    elseif input.KeyCode == Enum.KeyCode.S then
08        Char["LocalConditions"]:FindFirstChild("Back").Value = true
09    end
10end)
11uis.InputEnded:connect(function(input)
12    if input.KeyCode == Enum.KeyCode.W then
13        Char["LocalConditions"]:FindFirstChild("Forward").Value = false
14    elseif input.KeyCode == Enum.KeyCode.S then
15        Char["LocalConditions"]:FindFirstChild("Back").Value = false
16    end
17end)

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

How does this not work?

I tried it myself and It works just fine...

(gif): https://gyazo.com/0004e855d591856a00144ccda2d80010

Are you sure your LocalScript is located in StarterPlayerScripts?

And btw keep in mind changing these values with a LocalScript won't replicate to the server, only will change for the client.

0
The script is copied from ServerStorage to backpack. I have quite a bit of other code in this script, but I don't think it would interfere with this. Video: https://streamable.com/106aly NykoVania 231 — 2y
0
First of all, that video uploading website seems cool, how did you record the video tho? 2nd of all, I think the problem might be how you copy the LocalScript to the player then? Because I just tried it myself again, this time copying the script from ServerStorage and it works just fine... Try using the server console to copy it maybe? I don't know. SharkRayMaster 265 — 2y
0
I recorded it with a built in recorder from Nvidia, I use the server console to copy it already, but I figured out the issue??? I had to put the code before everything else in the script for some reason? Thank you for trying to help lol I think studio might just be janky rn NykoVania 231 — 2y
0
Yea I found the recorded lol I don't have the requirements anyway, and well that is weird, might be a studio problem cuz for me it did work so idk, anyways good job! SharkRayMaster 265 — 2y
Ad

Answer this question