I already have the local script
Local script: /////////////////////////////////////////////////////
local Player = game:GetService("Players") local rp = game:GetService("ReplicatedStorage") local Teleport = rp.Stand1Remotes:WaitForChild("Teleport") local UIS = game:GetService("UserInputService") local debounce = false local cooldown = 10 UIS.InputBegan:Connect(function(input,isTyping) if isTyping then return elseif input.KeyCode == Enum.KeyCode.H and debounce == false then debounce = true Teleport:FireServer() end end) Teleport.OnClientEvent:Connect(function() wait(cooldown) debounce = false end)
////////////////////////////////////////////
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...
--// Let's start with a simple userInputService system local UIS = game:GetService('UserInputService') local Player = game:GetService'Players'.LocalPlayer local Mouse = Player:GetMouse() --// Gets the player's mouse local Cooldown = false UIS.InputBegan:Connect(function(key, IsTyping) if IsTyping or Cooldown then return end --// This will stop the player from teleporting while typing if key.KeyCode == Enum.KeyCode.H then --// Checks if the input is `H` Cooldown = true 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 local Root = Character:WaitForChild('HumanoidRootPart') Root.CFrame = Mouse.Hit --// Mouse.Hit is a CFrame! wait(3) Cooldown = false end end)
Hopefully this makes sense!
local player = game.Players.LocalPlayer -- player local mouse = player:GetMouse() -- gets the cursor mouse.KeyDown:Connect(function(key) -- when a player presses a button it will use this as the function if key == 'h' then -- detects if the player presses 'h' player.Character.HumanoidRootPart.CFrame = mouse.Hit -- teleports the player to cursor end end)