Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR LUA

Roblox studio increase variable when holding W

local holding=false
userInputService.InputBegan:Connect(function(input, gameProcessedEvent)
	if input.KeyCode == forward_key then 
		holding = true 
	end
	
	while holding do
			b_gyro.CFrame = CFrame.new(hrp.Position,mouse.Hit.p)
			lv = b_gyro.CFrame.LookVector
			b_velocity.Velocity = Vector3.new(lv.X * speed, lv.Y * speed, lv.Z * speed)
			wait(1)
	end
end)

userInputService.InputEnded:Connect(function(input, gameProcessedEvent)
	holding = false b_velocity.Velocity = Vector3.new(0,0,0)
end)
Source by devforum.roblox.com #
 
PREVIOUS NEXT
Tagged: #Roblox #studio #increase #variable #holding #W
ADD COMMENT
Topic
Name
2+1 =