Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My Int Value is not changing across Scripts?

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

1 comment

0

put your script in a code block

1 answer

please use a code block its the blue lua

1 comment

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.