I already have the local script
Local script: /////////////////////////////////////////////////////
01 | local Player = game:GetService( "Players" ) |
02 |
03 | local rp = game:GetService( "ReplicatedStorage" ) |
04 | local Teleport = rp.Stand 1 Remotes:WaitForChild( "Teleport" ) |
05 |
06 |
07 | local UIS = game:GetService( "UserInputService" ) |
08 |
09 | local debounce = false |
10 | local cooldown = 10 |
11 |
12 | UIS.InputBegan:Connect( function (input,isTyping) |
13 | if isTyping then |
14 | return |
15 |
////////////////////////////////////////////
i can do anything in the script heres what i could do :3
local rp = game:GetService("ReplicatedStorage") local Teleport = rp.Stand1Remotes:WaitForChild("Teleport")
////////////////////////////////////////
Okay so first of all, the Character
belongs to the player so no need to handle it with a server script! Sometimes, the answer is just in our palms but we cannot reach to it...
01 | --// Let's start with a simple userInputService system |
02 | local UIS = game:GetService( 'UserInputService' ) |
03 | local Player = game:GetService 'Players' .LocalPlayer |
04 | local Mouse = Player:GetMouse() --// Gets the player's mouse |
05 | local Cooldown = false |
06 | UIS.InputBegan:Connect( function (key, IsTyping) |
07 | if IsTyping or Cooldown then return end --// This will stop the player from teleporting while typing |
08 | if key.KeyCode = = Enum.KeyCode.H then --// Checks if the input is `H` |
09 | Cooldown = true |
10 | local Character = Player.Character or Player.CharacterAdded:Wait() --// Why define it under the event? Well, that is because when the player dies, character replaces unlike the player |
11 | local Root = Character:WaitForChild( 'HumanoidRootPart' ) |
12 | Root.CFrame = Mouse.Hit --// Mouse.Hit is a CFrame! |
13 | wait( 3 ) |
14 | Cooldown = false |
15 | end |
16 | end ) |
Hopefully this makes sense!
1 | local player = game.Players.LocalPlayer -- player |
2 | local mouse = player:GetMouse() -- gets the cursor |
3 |
4 | mouse.KeyDown:Connect( function (key) -- when a player presses a button it will use this as the function |
5 | if key = = 'h' then -- detects if the player presses 'h' |
6 | player.Character.HumanoidRootPart.CFrame = mouse.Hit -- teleports the player to cursor |
7 | end |
8 | end ) |