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

Use Touch Interest without it glitching with other objects?

Asked by 7 years ago
Edited 7 years ago

Im making a kamehameha script but when i put a touch interest in the beam of the kamehameha it moves around and glitches and it wont stand still, goes up even tho i anchored it please help without touch interest https://cdn.discordapp.com/attachments/343099799928832000/356955649030094849/without.PNG with touch interest https://cdn.discordapp.com/attachments/343099799928832000/356955595338940419/with_touchinterest.PNG

forward = 0
    Kamehameha = Instance.new("Model",Character)
beamstart = New("Part",Kamehameha)
beamstart.Size = Vector3.new(3,3,3)
beamstart.Anchored = true
beamstart.CanCollide = false
beamstart.Color = Color3.fromRGB(255,255,255)
beamstart.CFrame = CFrame.new(RootPart.Position + Vector3.new(0,1,0))*CFrame.Angles(0,math.rad(0),0)+RootPart.CFrame.lookVector * 3
beamstart.Material = "Neon"
mesh1 = Instance.new("SpecialMesh",beamstart)
mesh1.MeshType = "Sphere"
beamstart1 = New("Part",Kamehameha)
beamstart1.Size = Vector3.new(4,4,4)
beamstart1.Anchored = true
beamstart1.CanCollide = false
beamstart1.Color = Color3.fromRGB(0,110,255)
beamstart1.CFrame = CFrame.new(RootPart.Position + Vector3.new(0,1,0))*CFrame.Angles(0,math.rad(0),0)+RootPart.CFrame.lookVector * 3
beamstart1.Material = "Neon"
beamstart1.Transparency = 0.6
mesh1 = Instance.new("SpecialMesh",beamstart1)
mesh1.MeshType = "Sphere"
beam = New("Part",Kamehameha)
beam.Size = Vector3.new(3,2,2)
beam.Anchored = true
beam.CanCollide = false
beam.Color = Color3.fromRGB(255,255,255)
beam.CFrame = CFrame.new(RootPart.Position + Vector3.new(0,1,0))*CFrame.Angles(0,math.rad(90),0)+RootPart.CFrame.lookVector * 5
beam.Material = "Neon"
mesh1 = Instance.new("SpecialMesh",beam)
mesh1.MeshType = "Cylinder"
beam1 = New("Part",Kamehameha)
beam1.Size = Vector3.new(3,3,3)
beam1.Anchored = true
beam1.CanCollide = false
beam1.Color = Color3.fromRGB(0,110,255)
beam1.CFrame = CFrame.new(RootPart.Position + Vector3.new(0,1,0))*CFrame.Angles(0,math.rad(90),0)+RootPart.CFrame.lookVector * 5
beam1.Material = "Neon"
beam1.Transparency = 0.6
mesh1 = Instance.new("SpecialMesh",beam1)
mesh1.MeshType = "Cylinder"
beamend = New("Part",Kamehameha)
beamend.Size = Vector3.new(3,3,3)
beamend.Anchored = true
beamend.CanCollide = false
beamend.Color = Color3.fromRGB(255,255,255)
beamend.CFrame = CFrame.new(RootPart.Position + Vector3.new(0,1,0))*CFrame.Angles(0,math.rad(0),0)+RootPart.CFrame.lookVector * 7
beamend.Material = "Neon"
mesh1 = Instance.new("SpecialMesh",beamend)
mesh1.MeshType = "Sphere"
beamend1 = New("Part",Kamehameha)
beamend1.Size = Vector3.new(4,4,4)
beamend1.Anchored = true
beamend1.CanCollide = false
beamend1.Color = Color3.fromRGB(0,110,255)
beamend1.CFrame = CFrame.new(RootPart.Position + Vector3.new(0,1,0))*CFrame.Angles(0,math.rad(0),0)+RootPart.CFrame.lookVector * 7
beamend1.Material = "Neon"
beamend1.Transparency = 0.6
mesh1 = Instance.new("SpecialMesh",beamend1)
mesh1.MeshType = "Sphere"
workspace.Camera.CameraType = "Watch"
    workspace.Camera.CameraSubject = beamend

--  beam.Touched:connect(function(hit)
--      if hit.Parent:FindFirstChild("Humanoid") ~= nil then
--          Explode = New("Part",Kamehameha)
--Explode.Size = Vector3.new(3,3,3)
--Explode.Anchored = true
--Explode.CanCollide = false
--Explode.Color = Color3.fromRGB(255,255,255)
--Explode.CFrame = hit.CFrame
--Explode.Material = "Neon"
--
--mesh1 = Instance.new("SpecialMesh",Explode)
--mesh1.MeshType = "Sphere"
--Explode1 = New("Part",Kamehameha)
--Explode1.Size = Vector3.new(4,4,4)
--Explode1.Anchored = true
--Explode1.CanCollide = false
--Explode1.Color = Color3.fromRGB(0,110,255)
--Explode1.CFrame = hit.CFrame
--Explode1.Material = "Neon"
--Explode1.Transparency = 0.6
--mesh1 = Instance.new("SpecialMesh",Explode1)
--mesh1.MeshType = "Sphere"
--for i = 1,10 do
--  Explode.Size = Explode.Size + Vector3.new(1,1,1)
--  Explode1.Size = Explode1.Size + Vector3.new(1,1,1)
--  Explode.Transparency = Explode.Transparency + Vector3.new(0.1,0.1,0.1)
--  Explode1.Transparency = Explode1.Transparency + Vector3.new(0.1,0.1,0.1)
--end
--      end
--      
--      
--      
--      end)
for i = 1,10 do
for i = 1,2 do
    wait()
    forward = forward +2
    beamsize = beamsize + 0.1
    beamend1.CFrame = CFrame.new(RootPart.Position + Vector3.new(0,1,0)+Vector3.new(math.random(-0.1,0.1),math.random(-0.1,0.1),math.random(-0.1,0.1)))*CFrame.Angles(0,math.rad(0),0)+RootPart.CFrame.lookVector * (6.5 + beamsize/2 + forward * 4)
    beamend.CFrame = CFrame.new(RootPart.Position + Vector3.new(0,1,0)+Vector3.new(math.random(-0.1,0.1),math.random(-0.1,0.1),math.random(-0.1,0.1)))*CFrame.Angles(0,math.rad(0),0)+RootPart.CFrame.lookVector * (6.5 + beamsize/2 + forward * 4)
    beam1.CFrame = RootPart.CFrame *CFrame.Angles(0,math.rad(90),0)+ Vector3.new(0,1,0)+Vector3.new(math.random(-0.1,0.1),math.random(-0.1,0.1),math.random(-0.1,0.1))+RootPart.CFrame.lookVector * (4.5 + beamsize/2 + forward*2)
beam.CFrame = RootPart.CFrame *CFrame.Angles(0,math.rad(90),0)+ Vector3.new(0,1,0)+Vector3.new(math.random(-0.1,0.1),math.random(-0.1,0.1),math.random(-0.1,0.1))+RootPart.CFrame.lookVector * (4.5 + beamsize/2 + forward*2)
beamstart1.CFrame = CFrame.new(RootPart.Position + Vector3.new(0,1,0)+Vector3.new(math.random(-0.1,0.1),math.random(-0.1,0.1),math.random(-0.1,0.1)))*CFrame.Angles(0,math.rad(0),0)+RootPart.CFrame.lookVector * (3+beamsize/2)
beamstart.CFrame = CFrame.new(RootPart.Position + Vector3.new(0,1,0)+Vector3.new(math.random(-0.1,0.1),math.random(-0.1,0.1),math.random(-0.1,0.1)))*CFrame.Angles(0,math.rad(0),0)+RootPart.CFrame.lookVector * (3+beamsize/2)
beam1.Size = Vector3.new(3,beamsize+1,beamsize+1) + Vector3.new(forward*4,0,0)
beam.Size = Vector3.new(3,beamsize,beamsize) + Vector3.new(forward*4,0,0)
beamend1.Size = Vector3.new(beamsize+2,beamsize+2,beamsize+2)
beamend.Size = Vector3.new(beamsize+1,beamsize+1,beamsize+1)
beamstart1.Size = Vector3.new(beamsize+2,beamsize+2,beamsize+2)
beamstart.Size = Vector3.new(beamsize+1,beamsize+1,beamsize+1)
end
for i = 1,2 do
    wait()
    beamsize = beamsize + 0.1
    forward = forward + 2
    beamend1.CFrame = CFrame.new(RootPart.Position + Vector3.new(0,1,0)+Vector3.new(math.random(-0.1,0.1),math.random(-0.1,0.1),math.random(-0.1,0.1)))*CFrame.Angles(0,math.rad(0),0)+RootPart.CFrame.lookVector * (6.5 + beamsize/2 + forward * 4)
    beamend.CFrame = CFrame.new(RootPart.Position + Vector3.new(0,1,0)+Vector3.new(math.random(-0.1,0.1),math.random(-0.1,0.1),math.random(-0.1,0.1)))*CFrame.Angles(0,math.rad(0),0)+RootPart.CFrame.lookVector * (6.5 + beamsize/2 + forward * 4)
    beam1.CFrame = RootPart.CFrame *CFrame.Angles(0,math.rad(90),0)+ Vector3.new(0,1,0)+Vector3.new(math.random(-0.1,0.1),math.random(-0.1,0.1),math.random(-0.1,0.1))+RootPart.CFrame.lookVector * (4.5 + beamsize/2 + forward*2)
beam.CFrame = RootPart.CFrame *CFrame.Angles(0,math.rad(90),0)+ Vector3.new(0,1,0)+Vector3.new(math.random(-0.1,0.1),math.random(-0.1,0.1),math.random(-0.1,0.1))+RootPart.CFrame.lookVector * (4.5 + beamsize/2 + forward*2)
beamstart1.CFrame = CFrame.new(RootPart.Position + Vector3.new(0,1,0)+Vector3.new(math.random(-0.1,0.1),math.random(-0.1,0.1),math.random(-0.1,0.1)))*CFrame.Angles(0,math.rad(0),0)+RootPart.CFrame.lookVector * (3+beamsize/2)
beamstart.CFrame = CFrame.new(RootPart.Position + Vector3.new(0,1,0)+Vector3.new(math.random(-0.1,0.1),math.random(-0.1,0.1),math.random(-0.1,0.1)))*CFrame.Angles(0,math.rad(0),0)+RootPart.CFrame.lookVector * (3+beamsize/2)
beam1.Size = Vector3.new(3,beamsize+1.5,beamsize+1.5) + Vector3.new(forward*4,0,0)
beam.Size = Vector3.new(3,beamsize+.5,beamsize+.5) + Vector3.new(forward*4,0,0)
beamend1.Size = Vector3.new(beamsize+2.5,beamsize+2.5,beamsize+2.5)
beamend.Size = Vector3.new(beamsize+1.5,beamsize+1.5,beamsize+1.5)
beamstart1.Size = Vector3.new(beamsize+2.5,beamsize+2.5,beamsize+2.5)
beamstart.Size = Vector3.new(beamsize+1.5,beamsize+1.5,beamsize+1.5)
end
end
for i = 1,30 do
    wait()
    beamstart1.Size = beamstart1.Size - Vector3.new(beamstart1.Size.x/10,beamstart1.Size.y/10,beamstart1.Size.z/10)
    beamstart.Size = beamstart.Size - Vector3.new(beamstart.Size.x/10,beamstart.Size.y/10,beamstart.Size.z/10)
    beamend.Size = beamend.Size - Vector3.new(beamend.Size.x/10,beamend.Size.y/10,beamend.Size.z/10)
    beamend1.Size = beamend1.Size - Vector3.new(beamend1.Size.x/10,beamend1.Size.y/10,beamend1.Size.z/10)
    beam.Size = beam.Size - Vector3.new(0,beam.Size.y/10,beam.Size.z/10)
    beam1.Size = beam1.Size - Vector3.new(0,beam1.Size.y/10,beam1.Size.z/10)
end
Kamehameha:Destroy()

workspace.Camera.CameraType = "Custom"
    workspace.Camera.CameraSubject = Character.Humanoid

1 answer

Log in to vote
0
Answered by 7 years ago

I don't know if i am exactly right but if you're trying to make a object still and you've anchored, then go to View tab then click on output. It will show you what is going on and what you need to fix, such as, "On line 68, "Print ("Hello). Expected "". it would show you why its constant moving and glitching. Try to look into the physical side of the script. And why is the position moving. If you tried that then check you're lines that include moving you're object or some how physically touching it, like Vector 3 or X,Y,Z. Make sure it doesn't affect any other lines except for that one or others that need variables, and make sure it doesn't affect the Touch Interest. I don't know if this works for you or not, but hope it does!

Ad

Answer this question