Turret rotation doesn't work (BP)

I’m making a turret for a tower defense game but it isn’t rotating properly.

This is the event graph for the turret.

and this is for the function that detects enemies:

the turret comes up with these errors:

Accessed none ‘target’ from node setworldrotation from graph ‘eventgraph’ in blueprint ‘turret’

and the same again but for linetracebychannel instead of setworldrotation.

what’s causing this error and how do I fix it?

You looking for this…

Narg

Yeah thats exactly what I’m after, I think the blueprints above should make something like that but there’s an error in there somewhere.

Hello MeGaJ0eY,

If you having an Access none Error this means that when the function (SetWorldRotation in this case) goes to call for it’s Target there is a null value. This means that “Cone” is empty. One way to get around this would be to use an isValid check on “Cone”. Another way would be to make sure that “Cone” is set before it gets called by the function (SetWorldRotation) I hope that this information helps.

Make it a great day

Thanks for the answer but I’m still having problems how do I get the cone static mesh component in order to set the cone variable? also I don’t remember creating the cone variable so why has it appeared?

Okay I’ve fixed the errors but the turret isn’t rotating every tick, it does it once when spawned but it wont change its rotation during play. how do I fix this?