Hello Developers
So i’m having troubles with this touch event. as you can see in the video, i am touching the part with a saber, but when it touched, it does nothing. I assume it’s on the properties but i already tried that but i failed. I tried searching but it doesn’t really help any because it’s about the health event/ coin event/ etc. so as you can see in the script, it should unanchor the parent and play a sound. but it didn’t play any or did unanchor the object.
yes i tried that, that’s actually the first version of that script
script.Parent.Hit.Touched:Connect(function(saber)
print('blue')
if saber.Name == 'SaberBlue' then
script.Parent.Slash:Play()
script.Parent.Anchored = false
end
end)
You should show people your explorer, and the code probably didn’t worked because other things may be parented to script’s parent, so you need to check if v == a hit block.
script.Parent.Touched:Connect(function(saber)
print('started')
end)
script.Parent.TouchEnded:Connect(function(saber)
print('ended')
end)
while wait(0.1) do
if game.Workspace:ArePartsTouchingOthers({game.Workspace.SaberBlue,script.Parent},0) then
script.Parent.Parent.Anchored = false
script.Parent.audio:Play()
end
end
and you may ask, why did i still placed the Touched/TouchEnded even though the solution was game.Workspace:ArePartsTouchingOthers. Well i tried removing it but it completely make it not working so i leave it there.Thank you too! to people who helped me, i really appreciate it!