Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-2

Hi, Teleporting. Help?

Asked by 9 years ago

I want make a script.

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

Please help somebody.

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. M39a9am3R 3210 — 9y

1 answer

Log in to vote
1
Answered by 9 years ago

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 :)

0
Thanks! :D HzRobux 0 — 9y
Ad

Answer this question