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

Hi, Teleporting. Help?

I want make a script.

When i press 'r' , i want go to mouse's position.

Please help somebody.

1 comment

0

Sir, ScriptingHelpers is not a site to ask for scripts, but is a site for aiding in the debugging or explanation of scripts and functions. We ask that you make a attempt to create your own script prior to and within your questions. Thank you.

1 answer

✓ Accepted answer

First, find the player when they enter, and get their mouse Using a local script in StarterGui

local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()

now set an event for on key down

local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
mouse.KeyDown:connect(function(key)

end)

Now set conditions for which key:

local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
mouse.KeyDown:connect(function(key)
	if key == "r" then
		
	end
end)

Now Teleport:

local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
mouse.KeyDown:connect(function(key)
	if key == "r" then
		if plr.Character then --check if character is there
			plr.Character:MoveTo(mouse.Hit.p) --move to mouse's position
		end
	end
end)

Ask me for further help :)

1 comment

0

Thanks! :D

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