I’m trying to make a tool that uses :GetMouse() from player, it doesn’t need to be with mouse it can be with another solution i just wanted to know if theres a way to do what i want to do, so basically what i want to do is a tool that tps behind the player
My script Doesn’t work does not matter if i use mouse.Target since it doesn’t Work
I’ve searched the whole night up on everywhere not found a single thing about it.
My current broken code ( local script on tool )
local player = game.Players.LocalPlayer
local chara = player.Character
local tool = script.Parent
local players = game.Players
local re = script.RemoteEvent
local canab = game.ReplicatedStorage.Values.CanAbility
local mouse = player:GetMouse()
if tool.Equipped then
if mouse.Hit.p == player.Position and tool.Triggered then
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