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

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

Asked by 6 years ago

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

1
To get the mouse's position it's mouse.Hit.p, and to move the character use char:MoveTo(mouse.Hit.p) Jesse1240 59 — 6y
0
Ok thx FilthyMonsterPlays 8 — 6y
0
but doescent that only activate if i click the mouse? FilthyMonsterPlays 8 — 6y
0
Nope. I used to think that too. Jesse1240 59 — 6y
View all comments (3 more)
0
oh ok thx FilthyMonsterPlays 8 — 6y
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 FilthyMonsterPlays 8 — 6y
0
Maybe learn more of the basics. hiimgoodpack 2009 — 6y

1 answer

Log in to vote
0
Answered by
Azarth 3141 Moderation Voter Community Moderator
6 years ago
Edited 6 years ago
-- 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)
0
ok FilthyMonsterPlays 8 — 6y
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 FilthyMonsterPlays 8 — 6y
0
Edited. Azarth 3141 — 6y
0
what do u mean Edited I dont Understand Sorry? FilthyMonsterPlays 8 — 6y
0
I edited it so that you can toggle when its on with the F key Azarth 3141 — 6y
Ad

Answer this question