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

Script doesn't do anything but doesn't give any error messages either?

Asked by 5 years ago

So I have this script here, which I've had some issues with in the past. This script works fine according to the output, because it doesn't give any error messages or anything. But the problem is: The script doesn't do anything either, I don't know what happened. Can someone help?

Script:

local gun = workspace.Turret.Gun
local originpoint = gun.CFrame.p

script.Parent.Radar.Radar.Touched:connect(function(plr)
    if plr.Parent:IsA("Model") and plr.Parent:FindFirstChild("Humanoid") and game.Players.LocalPlayer.Character:FindFirstChild("Head") then
    script.Parent.Gun.alert:Play()
    local ignore = {script.Parent,game.Players[plr.Parent.Name]}
    local ray = Ray.new(originpoint,plr.Parent.Head.CFrame.p.Unit*100)
    local gun,position = workspace:FindPartOnRayWithIgnoreList(ray,ignore,false,true)

    local beam = Instance.new ("Part")
    beam.BrickColor = BrickColor.Red()
    beam.Material = "Neon"
    beam.Transparency = 50
    beam.Anchored = true
    beam.Locked = true
    beam.CanCollide = false

    local Distance = (script.Parent.Gun.CFrame.p-position).magnitude
    local distance = Distance/8
    repeat
        beam.Size = Vector3.new(.15,.15,distance)
        beam.CFrame = CFrame.new(script.Parent.Gun.CFrame.p,position)*CFrame.new(0,0,-distance/2)
        distance = distance*2
        wait (0.01)
    until distance == Distance*2

    beam.Touched:connect(function(hit)
        if hit.Parent:IsA("Model") and hit.Parent:FindFirstChild("Humanoid") then
            local human = hit.Parent:FindFirstChild("Humanoid")
        human:TakeDamage(10^308)






    game:GetService("Debris"):AddItem(beam,.1)








    game:GetService("Debris"):AddItem(beam,.1)

end
end)

end
end)

Thanks for helping, it is apperciated!

0
Easiest way to figure out what's wrong is use the infinite print method. Simply put a print on every line in the code and see where it stops. Works like a charm. iiDayzie_Dreams 32 — 5y
0
DO you have FE(Filter Enable) on? If yes, you need to script it using remote event. RainbowBeastYT 85 — 5y

Answer this question