ClassName not indentifying on mouse.Target

I want to put so when a player is hovering over the player it teleports behind them but the classname and IsA is not indentifying on the mouse.Target

I tried looking everywhere not found anyone talking about it, it could be a simple mistake either way i don’t know how to fix it.

Localscript code inside the tool i made :

local player = game.Players.LocalPlayer
local tool = script.Parent
local players = game.Players

local re = script.RemoteEvent
local canab = game.ReplicatedStorage.Values.CanAbility

local mouse = player:GetMouse()
if mouse.Target:IsA("Model") then
	local hum = mouse.Target.Parent:WaitForChild("Humanoid")
	if hum then
		canab.Value = true
	end
end

local animationId = "99910051876265"

local animationPriority = Enum.AnimationPriority.Action

local function playAnimation(player)
	local character = player.Character
	local humanoid = character:FindFirstChild("Humanoid")

	if humanoid then
		local animation = Instance.new("Animation")
		animation.AnimationId = "rbxassetid://" .. animationId

		local animationTrack = humanoid:LoadAnimation(animation)
		animationTrack.Priority = animationPriority
		animationTrack:Play()
	end
end

if canab.Value == true then
	tool.Activated:Connect(function()
		script.Parent.Handle.gr:Play()
		local Player = game.Players:GetPlayerFromCharacter(tool.Parent)
		if Player then
			playAnimation(Player)
		end
		re:FireServer(tool)
	end)
end

``

Mouse.Target:

image

This property is not capable of referencing anything other than a BasePart

Oh thanks i actually feel embarassed now, anyways thanks for making me notice it

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.