This is a short GIF of my problem - https://imgur.com/a/Efc9C

This is my localscript inside "StarterPlayer" .


local player = game.Players.LocalPlayer
repeat wait() until player.Character
local character = player.Character
local mouse = player:GetMouse()

local pressing = false

local Anim1 = character.Humanoid:LoadAnimation(script.Animation)
local Anim2 = character.Humanoid:LoadAnimation(script.Animation2)

script.DamageScript:Clone().Parent = character

mouse.KeyDown:connect(function(key)
if key == "1" and pressing == false then
	
	Anim1:Play()
	pressing = true
	wait(1)
	Anim1:Stop()
	Anim2:Play()
	Anim2:AdjustSpeed(0.1)
	script.blast:Clone().Parent = character.UpperTorso
	character.UpperTorso.blast:Destroy()
	print("KAMEHAMEHAA!!!")	
	
	local WalkSpeedBackup = character.Humanoid.WalkSpeed
	local JumpBackup = character.Humanoid.JumpPower
	wait()
	character.Humanoid.JumpPower = 0
	character.Humanoid.WalkSpeed = 0
	
	local Ball = Instance.new("Part",workspace)
	Ball.Material = "Neon"
	Ball.BrickColor = BrickColor.Blue()
	Ball.Anchored = true
	Ball.CanCollide = false
	Ball.CFrame = character.HumanoidRootPart.CFrame + (character.HumanoidRootPart.CFrame.lookVector*2)
	Ball.Shape = "Ball"
	Ball.Size = Vector3.new(1,1,1)
	Ball.Transparency = 0.3
	local Ball2 = Instance.new("Part",workspace)
	Ball2.Material = "Neon"
	Ball2.BrickColor = BrickColor.White()
	Ball2.Anchored = true
	Ball2.CanCollide = false
	Ball2.CFrame = character.HumanoidRootPart.CFrame + (character.HumanoidRootPart.CFrame.lookVector*10)
	Ball2.Shape = "Ball"
	Ball2.Size = Vector3.new(1,1,1)
	local Ball3 = Instance.new("Part",workspace)
	Ball3.Material = "Neon"
	Ball3.BrickColor = BrickColor.White()
	Ball3.Anchored = true
	Ball3.CanCollide = false
	Ball3.CFrame = Ball2.CFrame - Ball2.CFrame.lookVector
	Ball3.Shape = "Ball"
	Ball3.Size = Vector3.new(1,1,1)
	Ball3.Transparency = 0.5
	Ball3.Orientation = Ball3.Orientation + Vector3.new(90,0,0)
	local Mesh = Instance.new("SpecialMesh",Ball3)
	Mesh.MeshId = "http://www.roblox.com/asset/?id=20329976"
	local RAY = Instance.new("Part",workspace)
	local RAYmesh = Instance.new("CylinderMesh",RAY)
	RAY.Anchored = true
	RAY.CanCollide = false
	RAY.Material = "Neon"
	RAY.BrickColor = BrickColor.Blue()
	RAY.Size = Vector3.new(5,1,5)
	RAY.CFrame = character.HumanoidRootPart.CFrame + (character.HumanoidRootPart.CFrame.lookVector*8)
	RAY.Name = "RAY"
	local RAY2 = Instance.new("Part",workspace)
	local RAYmesh2 = Instance.new("CylinderMesh",RAY2)
	RAY2.Anchored = true
	RAY2.CanCollide = false
	RAY2.Material = "Neon"
	RAY2.BrickColor = BrickColor.White()
	RAY2.Size = Vector3.new(4,1,4)
	RAY2.CFrame = character.HumanoidRootPart.CFrame + (character.HumanoidRootPart.CFrame.lookVector*8)
	RAY.Transparency = 1
	RAY2.Transparency = 1
	RAY.Name = "RAY2"
	
	local s = 0
	
	repeat
		wait()
		mathrad = math.random(45,90)
		Ball3.CFrame  = Ball3.CFrame * CFrame.fromEulerAnglesXYZ(0, mathrad, 0) 
		Ball3.Mesh.Scale = Ball.Size - Vector3.new(2,2,2)
		Ball.Size = Ball.Size + Vector3.new(1.2,1.2,1.2)
		Ball.CFrame = character.HumanoidRootPart.CFrame + (character.HumanoidRootPart.CFrame.lookVector*8)
		Ball2.Size = Ball2.Size +Vector3.new(1.2,1.2,1.2)
		Ball2.CFrame = character.HumanoidRootPart.CFrame + (character.HumanoidRootPart.CFrame.lookVector*8)
		s = s + 1
	until	
		s == 10
	s = 0
	
	
	RAY.Transparency = 0.3
	RAY2.Transparency = 0
	
	repeat
		wait()
		mathrad = math.random(45,90)
		Ball3.CFrame  = Ball3.CFrame * CFrame.fromEulerAnglesXYZ(0, mathrad, 0)
		RAY.Size = RAY.Size + Vector3.new(0.1,3,0.1)
		RAY.CFrame = RAY.CFrame + character.HumanoidRootPart.CFrame.lookVector*1.5
		RAY.Orientation = Ball.Orientation + Vector3.new(90,0,0)
		RAY2.Size = RAY2.Size + Vector3.new(0.1,3,0.1)
		RAY2.CFrame = RAY2.CFrame + character.HumanoidRootPart.CFrame.lookVector*1.3
		RAY2.Orientation = Ball.Orientation + Vector3.new(90,0,0)
		s = s + 1
	until	
		s == 20
	wait()
	repeat
		wait()
		mathrad = math.random(45,90)
		Ball3.CFrame  = Ball3.CFrame * CFrame.fromEulerAnglesXYZ(0, mathrad, 0)
		RAY.Size = RAY.Size + Vector3.new(0,3,0)
		RAY.CFrame = RAY.CFrame + character.HumanoidRootPart.CFrame.lookVector*1.5
		RAY.Orientation = Ball.Orientation + Vector3.new(90,0,0)
		RAY2.Size = RAY2.Size + Vector3.new(0,2.5,0)
		RAY2.CFrame = RAY2.CFrame + character.HumanoidRootPart.CFrame.lookVector*1.3
		RAY2.Orientation = Ball.Orientation + Vector3.new(90,0,0)
	until	
		pressing == false or RAY.Transparency >= 1
		
	repeat
		wait()
		mathrad = math.random(45,90)
		Ball3.CFrame  = Ball3.CFrame * CFrame.fromEulerAnglesXYZ(0, mathrad, 0)
		Ball3.Transparency = Ball3.Transparency + 0.05/2
		RAY.Transparency = RAY.Transparency + 0.05/2
		Ball.Transparency = Ball2.Transparency + 0.05/2
		RAY2.Transparency = RAY2.Transparency + 0.1/2
		Ball2.Transparency = Ball2.Transparency + 0.1/2
	until
		Ball.Transparency >= 1
	
	
		
	character.Humanoid.WalkSpeed = WalkSpeedBackup
	character.Humanoid.JumpPower = JumpBackup
	
	RAY.Touched:connect(function(hit)
		
		print(hit.Name)
		
	end)
	
	RAY:Destroy()
	RAY2:Destroy()
	Ball:Destroy()
	Ball2:Destroy()
	Ball3:Destroy()
end
end)

mouse.KeyUp:connect(function(key)
if key == "1" then
	
	pressing = false
	Anim2:Stop()
	
end
end)

well,it's a mess...I'll show you the point where I think the problem is.


s = 0

repeat
		wait()
		mathrad = math.random(45,90)
		Ball3.CFrame  = Ball3.CFrame * CFrame.fromEulerAnglesXYZ(0, mathrad, 0)
		RAY.Size = RAY.Size + Vector3.new(0.1,3,0.1)
		RAY.CFrame = RAY.CFrame + character.HumanoidRootPart.CFrame.lookVector*1.5
		RAY.Orientation = Ball.Orientation + Vector3.new(90,0,0)
		RAY2.Size = RAY2.Size + Vector3.new(0.1,3,0.1)
		RAY2.CFrame = RAY2.CFrame + character.HumanoidRootPart.CFrame.lookVector*1.3
		RAY2.Orientation = Ball.Orientation + Vector3.new(90,0,0)
		s = s + 1
	until	
		s == 20

The "Ray" Can Only Collide with anything else other than a Humanoid Torso.

can someone give me a clue how I can fix this?

2 comments

0

can you add a tl;dr section to your code?

0

Well, anyways, last time I checked, using mouse to get user input is deprecated and sends mixed messages, saying something been pressed when it has not.