Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I made a teleport move whats wrong?

local RepStore 		= game.ReplicatedStorage
local Store 		= RepStore:WaitForChild("Storage")
local RemoteStore 	= Store:WaitForChild("RemoteEvents")
local Remote 		= RemoteStore:WaitForChild("LightningTeleportEvent")


Remote.OnServerEvent:connect(function(player,Mouse)
	
	
local folder = workspace:FindFirstChild("DebrisFolder") or Instance.new("Folder",workspace)
folder.Name = "DebrisFolder"

local bolt = Instance.new("Part")
bolt.Name = "Electrode"
bolt.BrickColor = BrickColor.new("New Yeller")
bolt.Material = "Neon"
bolt.Transparency = 0
bolt.FormFactor = "Custom"
bolt.Size = Vector3.new(0.1,0.1,0.1)
bolt.CanCollide = false
bolt.Anchored = true



function ShootElectrode(from,too)
lastpos = from
local Step = 3
local off = 10
local Range = 400

local Distance = (from-too).magnitude	

for i = 0,Distance, Step do
	local from = lastpos
	local offset = Vector3.new(
		math.random(-Off,Off),
		math.random(-Off,Off),
		math.random(-Off,Off)
		                       )/10
		
	
	local too = from + - (from-too).unit*Step + offset
	
	
	
	local p = bolt:Clone()
	p.Parent = folder
	p.Size = Vector3.new(p.Size.x,p.Size.y,(from-too).magnitude )
	p.CFrame  =CFrame.new(from:Lerp(too,0.5),too)
	
	
	
	game.Devris:AddItem(p,0.2)
	lastpos = too

	end
	
	
end

end)

	



local from = player.Character.Head.Position
local too = Mouse.Position + Vector3.new(0,5,0)
if (from-too).magnitude <=  400 then
ShootElectrode(from,too)	

local electric = Instance.new("Sound")
electric.SoundId = "rbxassetid://157325701"
electric.MaxDistance  = 500
electric.Parent = player.Character.Head
electric.Playbackspeed = 1
electric:play()
ShootElectrode(from,too)	
player.Character:MoveTo(Mouse.Position)	
	

      																																																																																	


	end)

1 comment

0

Format your code in a codeblock (Between the two lines you have at the bottom). See this: https://forum.scriptinghelpers.org/topic/82/how-to-format-questions-answers-on-the-main-site

1 answer

I'm not exactly sure if this will fix it as you didnt send an error list but maybe its probably line 53: game.Devris:AddItem(p,0.2) -- Should be game.Debris:AddItem(p,0.2)

This discussion is preserved as it was. New answers, comments, and votes are closed.