Sorry for the long code, however I dont want any misunderstandings. The only problem in this script is how the animation wont play when I click where I want to go(It still teleports me just doesnt use the animation with the error of: "Play is not a valid member of Animation "Workspace.snipperdiaper.Tool.Animation"
If anyone can help me it would be very appreciated :D
script.Parent:WaitForChild("Animation")
local tool = script.Parent
local Animation = tool.Animation
local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local humanoid = char:FindFirstChild("HumanoidRootPart")
local HumanoidAn = char.Humanoid
local debounce = true
local mouse = player:GetMouse()
mouse.Button1Down:Connect(function()
if tool.Parent ~= char then
return
end
local position = mouse.Hit.Position
local AnimationTrack = HumanoidAn:LoadAnimation(Animation)
local function FireServer()
game:GetService("ReplicatedStorage").ClickToTeleportEvent:FireServer(position)
end
if debounce == true then
debounce = false
FireServer()
Animation:Play()
player.PlayerGui.ClickToTeleportGui.TextLabel.TextTransparency = 0
player.PlayerGui.ClickToTeleportGui.TextLabel.BackgroundTransparency = 0
player.PlayerGui.ClickToTeleportGui.TextLabel.Text = "CoolDown: 5"
task.wait(1)
player.PlayerGui.ClickToTeleportGui.TextLabel.Text = "CoolDown: 4"
task.wait(1)
player.PlayerGui.ClickToTeleportGui.TextLabel.Text = "CoolDown: 3"
task.wait(1)
player.PlayerGui.ClickToTeleportGui.TextLabel.Text = "CoolDown: 2"
task.wait(1)
player.PlayerGui.ClickToTeleportGui.TextLabel.Text = "CoolDown: 1"
task.wait(1)
player.PlayerGui.ClickToTeleportGui.TextLabel.Text = "CoolDown: 0"
task.wait(1)
player.PlayerGui.ClickToTeleportGui.TextLabel.TextTransparency = 1
player.PlayerGui.ClickToTeleportGui.TextLabel.BackgroundTransparency = 1
player.PlayerGui.ClickToTeleportGui.TextLabel.Text = "CoolDown: 2"
debounce = true
end
end)
Thanks, snipperdiaper
