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

I want to do this TP script Like you TP where your mouse is But my script wont work?

ive never Done anything with Mouse, So Plz Have mercy on me Most of it is probably wrong im realy new to scripting so plz help me out

player = game.Players.LocalPlayer
mouse = player:GetMouse()
char = player.Character
tor = char.LowerTorso

function onKeyPress(inputObject, gameProcessedEvent)
	if inputObject.KeyCode == Enum.KeyCode.F then
local tp = mouse:Move()
 tor.Postion = tp.CFrame
end
game:GetService("UserInputService").InputBegan:connect(onKeyPress)

I want to make to make something Like the flash Step On bleach But it Wont Work At all, I just Want to be able to TP where the Mouse is

7 comments

1

To get the mouse's position it's mouse.Hit.p, and to move the character use char:MoveTo(mouse.Hit.p)

0

Ok thx

0

but doescent that only activate if i click the mouse?

0

Nope. I used to think that too.

0

oh ok thx

0

but i have no idea Where to put that at or how to start it sorry to Bother But can You tell me how it wold be like I started scripting About 5 days ago im pretty new So plz Tell me

0

Maybe learn more of the basics.

1 answer

-- Make your variables local, unless they have to be global. 
local inputservice = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
-- Wait for character if not available
local char = player.Character or player.CharacterAdded:wait()
local activated = false

inputservice.InputBegan:connect(function(input)
	if input.KeyCode == Enum.KeyCode.F then 
		activated = not activated
	end
end)

-- Anonymous function
mouse.Move:connect(function()
	-- mouse.Hit = CFrame
	-- mouse.Hit.p = Vector
	-- mouse.Hit.x = x-location

	-- Make it's activated 
	-- Make sure you're actually hovering over something and not the skybox
	if activated and mouse.Target then 
		char:MoveTo(mouse.Hit.p)
	end
end)

5 comments

0

ok

0

fot the most Part it works but When i activate it it wont stop moving me I putted a debounce But it still wont work But im better of then i was 4 hours ago xD thx

0

Edited.

0

what do u mean Edited I dont Understand Sorry?

0

I edited it so that you can toggle when its on with the F key

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