local S=0 local a=0 bin=script.Parent function TryToCast(S)local j=S:findFirstChild("\108\101\097\100\101\114\115\116\097\116\115")if j==nil then return false end local u=j:findFirstChild("\077\097\110\097")local P=j:findFirstChild("\076\101\118\101\108")if u==nil or P==nil then return false end if u.Value>=a then u.Value=u.Value-a return true end return false end function teleportPlayer(S)local a=game.Players.LocalPlayer if a==nil or a.Character==nil then return end local j=a.Character.HumanoidRootPart sound=Instance.new("\083\111\117\110\100")sound.SoundId=""sound.Parent=j sound.PlayOnRemove=true sound:remove()j.CFrame=CFrame.new(Vector3.new(S.x,S.y+7,S.z))sound=Instance.new("\083\111\117\110\100")sound.SoundId=""sound.Parent=j sound.PlayOnRemove=true sound:remove()end enabled=true function onButton1Down(a)if not enabled then return end local j=game.Players.LocalPlayer if j==nil then return end enabled=false a.Icon="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\092\065\114\114\111\119\070\097\114\067\117\114\115\111\114\046\112\110\103"local u=a.Hit local P=u.lookVector teleportPlayer(u.p)wait(S)a.Icon="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\092\065\114\114\111\119\067\117\114\115\111\114\046\112\110\103"enabled=true end function onSelected(S)S.Icon="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\092\065\114\114\111\119\067\117\114\115\111\114\046\112\110\103"S.Button1Down:connect(function()onButton1Down(S)end)end bin.Selected:connect(onSelected)


local COOLDOWN = 0
local MP = 0



bin = script.Parent

function TryToCast(player)
	-- returns true if player may cast this spell

	-- make sure this player has the wizard board stats
	local stats = player:findFirstChild("leaderstats")
	if stats == nil then return false end
	local mana = stats:findFirstChild("Mana")
	local level = stats:findFirstChild("Level")
	if mana == nil or level == nil then return false end

	if (mana.Value >= MP) then
		mana.Value = mana.Value - MP
		return true
	end

	return false
end




function teleportPlayer(pos)

	local player = game.Players.LocalPlayer
	if player == nil or player.Character == nil then return end

	local char = player.Character.HumanoidRootPart

	sound = Instance.new("Sound")
	sound.SoundId = ""
	sound.Parent = char
	sound.PlayOnRemove = true
	sound:remove()

	char.CFrame = CFrame.new(Vector3.new(pos.x, pos.y + 7, pos.z))


	sound = Instance.new("Sound")
	sound.SoundId = ""
	sound.Parent = char
	sound.PlayOnRemove = true
	sound:remove()

end


enabled = true
function onButton1Down(mouse)
	if not enabled then
		return
	end

	local player = game.Players.LocalPlayer
	if player == nil then return end
	--if TryToCast(player) == false then return end
	

	enabled = false
	mouse.Icon = "rbxasset://textures\\ArrowFarCursor.png"

	-- find the best cf
	local cf = mouse.Hit
	local v = cf.lookVector

	teleportPlayer(cf.p)

	wait(COOLDOWN)
	mouse.Icon = "rbxasset://textures\\ArrowCursor.png"
	enabled = true

end

function onSelected(mouse)
	mouse.Icon = "rbxasset://textures\\ArrowCursor.png"
	mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end

bin.Selected:connect(onSelected)

