Speed depends of value

Im creating a game, where you can train value by clicking on screen and there is one more value - Wins. To get Wins we need to go to wall but touch the wall you can when you have, like, 100 value. But if you have less than 100, you will be more slowly. How do I can do this?

Thanks!

Let me clarify:
You’re making a game where you increase some Value by clicking on the screen. You then have to walk to a wall to touch it and get “a win”, but your character’s speed depends on Value and you can only get “a win” if you have a certain amount of Value?

do you know game sisyphus simulator? If yes, I wanna make mechanics like in that game

I see.
So, first of all, you’d probably wanna start with creating a variable to save your Value (strength in Sisyphus Simulator’s case). You can do that by, for example, Instancing an IntValue inside your players when they join. (This guide shows how to do most of those things. You can look into creating a DataStore at some point as well).

To get mouse clicks you can use UserInputService (the code sample there already shows how to process MouseButton1 clicks). So you should increment your Value every time the player clicks.

If you just want to change the speed of your character, depending on how big your Value is, then you’d want to check for changes in your Value and then calculate and change character’s WalkSpeed however you like.

Feel free to ask more questions or anything in particular.

RunService.RenderStepped....
    if Value < 100 then
       WalkSpeed = 10
   elseif Value > 100 then
       WalkSpeed = 50
   end
end
1 Like

Im creating game not like sisyphus sim. I tried to do this:

game["Run Service"].RenderStepped:Connect(function()
	local ArmMotor6D = char.Torso["Right Shoulder"]
	local normal_speed = game.StarterPlayer.CharacterWalkSpeed
	local required = 100
	local current = plr.leaderstats.Strength.Value
	local maximal_mag = ((required-current)/normal_speed)*10
	local part = workspace.SpawnLocation
	local arm = char["Right Arm"]
	arm.Massless = true
	local magnitude = (arm.Position-part.Position).Magnitude
	local jointPosition = ArmMotor6D.Part0.CFrame:toWorldSpace(CFrame.new(0.9,0.25,0.25))
	local cframe = CFrame.new(jointPosition.p, part.Position) * CFrame.Angles(math.pi/2, 0, 0) * CFrame.new(0, -1.5, 0)
	arm.Size = Vector3.new(arm.Size.X, magnitude, arm.Size.Z)
	ArmMotor6D.C0 = ArmMotor6D.Part0.CFrame:toObjectSpace(cframe)*CFrame.new(0,-magnitude/2,0)
	
	
	
	if magnitude >= maximal_mag then
		humanoid.WalkSpeed = normal_speed-(magnitude*2/maximal_mag)
	else
		humanoid.WalkSpeed = normal_speed
	end
	
	print(humanoid.WalkSpeed)
end)

This is testing version

Is it going well? How’s the progress with clicking the mouse to increment the value?

umm, i mean, i just donk know how to make engine like in sisyphus sim, like, speed depends of value and mag. I know almost everything in scripting, yo

By “engine” do you mean “how to move/push the object”?

nah, i mean how to make speed depends of ur value of Strength and of magnitude of part with character

I tried, but there is a problem, yeah, it works, but when you have 80 of 100 strength, you are beeing more slowly

wait, there is gameplay:

i got it:

local requiredValue = 2500
local currentValue = 2000
local max_mag = (currentValue/requiredValue )*100
print(max)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.