I'm making a running script for all platforms. It took me like 3 days to make because of bugs and stuff. For the running script for controller, I made it so it puts a boolean value inside of the player's character that sees if the player is running or not. This is so when the player presses a button on the controller, it makes you run, but then when you press the same button after, it stops running. This is the part of the script I used to add the boolean value.
local char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait() game.Players.LocalPlayer.CharacterAdded:Connect(function() boolean = Instance.new("BoolValue") boolean.Parent = char boolean.Name = "run" boolean.Value = false end)
In the code I said, "boolean.Parent = char", yet the value doesn't appear anywhere. It's probably still parented to nil, and I don't know why.
Alright so I instantly saw what your problem was here, you are looking for the character then looking for the character to be added again. When using CharacterAdded:Connect(function() it sends over the new player character. So instead of what you had, your code should be this:
game:GetService("Players").LocalPlayer.CharacterAdded:Connect(function(Char) local boolean = Instance.new("BoolValue") boolean.Parent = char boolean.Name = "run" boolean.Value = false end)
Another way you could do it is a local script in the StarterCharacterScripts under StarterPlayer with just the boolean creation.
Hopefully this helps.
hey you! have you ever heard of enes? if you are in trouble, better call enes!