Time skip/teleport effect not working

so im new to scripting and i have problem with the teleport effect.
v This Is What I Want To Do v

what wrong in my script?

local script(in StarterPlayerScripts)

wait()
local Player = game:GetService("Players").LocalPlayer
local Mouse = Player:GetMouse()
Mouse.KeyDown:Connect(function(key)
	if key == "z" then --Change K to any keyboard button
		Player.Character:MoveTo(Mouse.Hit.p)
		local RS = game:GetService("ReplicatedStorage")
		local part = RS.Whirl
		local Character = Player.Character
		local humrp = Character.Humanoid.HumanoidRootPart
		local effect = part:Clone()
		effect.Parent = Character
		effect.CFrame = humrp.CFrame
		wait()
		effect.Transparency = 0.5
		wait()
		effect.size = Vector3.new(14.441, 7.408, 7.408)
		wait()
		effect.size = Vector3.new(10.236, 6.384, 6.384)
		wait()
		effect.Transparency = 1
		effect:Destroy()
	end
end)

also i have an error when i teleport:
HumanoidRootPart is not a valid member of Humanoid “Workspace.sagiv200421.Humanoid”

1 Like

To get Keybind you have to use Service called UserInputService and not the mouse object

2 Likes

Bro the root part is not inside the humanoid.

local humrp = Character.Humanoid.HumanoidRootPart
Use this:
local humrp = Character:WaitForChild(“HumanoidRootPart”)

3 Likes

it is HumanoidRootPart is not a valid member of Humanoid , HumanoidRootPart is inside the character , thats why , change humrp to :

local humrp = Character.HumanoidRootPart

You can detect a keyDown with mouse object.

1 Like

I know but using UIS is better practice

With the mouse object if you are chatting, it wont detect it.
And with the UIS yes.

There is an object called GameProcessed in UIS Inputs Events with checks the exact same thing