I’m trying to run a on touched function but it wont run when the part gets touched.
I may be running it wrong can someone point me in the right direction?
please and thanks in advance.
local function Launch()
-- otherstuff
local function Nuke(hit)
print("missile Touched!"..hit.Parent)
end
missile.Touched:Connect(Nuke)
print("Func started running")
for cycle = 1, 150 do
local mp = missile.Position
missile.CFrame = CFrame.new(mp.X, mp.Y - 3, mp.Z)
missile.Rotation = Vector3.new(-90,-90,0)
wait(.001)
print(cycle.." going down")
end
end
script.Parent.Equipped:Connect(function(ply)
local RemoteEvent = Instance.new("RemoteEvent",ReplicatedStorage)
RemoteEvent.Name = ("NukeNade")
RemoteEvent:FireServer(Launch())
end)
Not sure what you mean, but try something like this in a regular script.
local function Launch()
-- otherstuff
local function Nuke(hit)
print("missile Touched!"..hit.Parent)
end
missile.Touched:Connect(Nuke)
print("Func started running")
for cycle = 1, 150 do
local mp = missile.Position
missile.CFrame = CFrame.new(mp.X, mp.Y - 3, mp.Z)
missile.Rotation = Vector3.new(-90,-90,0)
wait(.001)
print(cycle.." going down")
end
end
script.Parent.Equipped:Connect(Launch)