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

My Int Value is not changing across Scripts?

Asked by
bogo01 0
4 years ago
Edited 4 years ago

So I have 2 local scrips in starter Character and a intValue called steps in replicated storage. What I am doing in the first script is changing the value of steps( A intValue in ReplicatedStorage) Then in the second script I am trying to change the character speed to the Steps they take but the value is not updated and everytime the script sees the value of steps as zero.

this local script is to add steps to the player if they are running-

local player = game.Players.LocalPlayer
local Steps = game.ReplicatedStorage.Steps.Value
local runningone = game.ReplicatedStorage:WaitForChild("Running")
local running = runningone.Value--bool to determine if player is running
local character = game.Players.LocalPlayer.Character
local WalkSpeed  = character.Humanoid.WalkSpeed
    character.Humanoid.Running:connect(function(speed) -- return value; speed of the running
        if speed > 0 then 
            running = true
            game.ReplicatedStorage.RemoteEvent:FireServer()
        elseif speed == 0 then
            running = false
        end
    end)
    while true do
    while running == true do -- adds steps to the player
        Steps = Steps +1 
        player.leaderstats.Steps.Value = Steps
        wait(.5)

    end
    wait(.5)
    end



this local script is to change the players speed from the steps

local player = game.Players.LocalPlayer
local Steps = game.ReplicatedStorage.Steps.Value
while true do
        player.Character.Humanoid.WalkSpeed = (Steps +1)*10 
        print(Steps)
        wait(.5)
    end
0
put your script in a code block SteamG00B 1633 — 4y

1 answer

Log in to vote
-1
Answered by 4 years ago

please use a code block its the blue lua

0
This is not an answer, the comment line is there for anyone to use, so please next time you have a comment, don't put it in an answer. SteamG00B 1633 — 4y
Ad

Answer this question