Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I made a teleport move whats wrong?

Asked by 5 years ago
Edited by User#5423 5 years ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.
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)

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 xPolarium 1388 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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)

Ad

Answer this question