How do I destroy a component on the client?
So i'm trying to make an equipment system:
When I pick up an item, I want to attach it to my character and make sure that everyone can see it. (server & clients) This is working. but there is one problem: The collision box which i'm using to pick it up, still exists. When I've equipped a helmet, anyone else can steal my helmet because this collision box is still there. So I've tried to destroy that collision box (destroy component) but it doesn't work no matter what I do.
the client is able to destroy a component in an actor, but the server and other clients can't see it. It only happens locally. I've tried destroying the component on the server but that doesn't seem to work either. I've also tried to destroy it and multicast it but with no effect. Sometimes the client doesn't want to execute any of my functions. I feel like i'm missing 1 simple and important thing. I've been struggling with this for 4 days now and I really can't find a solution anywhere on the entire internet. I've basically tried every possible way and now i'm tired and stuck.
Any help will be grately appreciated! If this gets fixed my entire project will fix itself.
First picture: My helmet blueprint
Second picture: Here you can see how I equip my helmet on the server.
Third picture: Here you can see what I want to destroy on client and server.
asked Apr 09 '19 at 09:18 PM in Blueprint Scripting
Did you replicate the item correctly? Did you try to Destroy the helmet completely? just to test if your destruction does actually replicate. Personally I would just disable the collider, because you might want to throw the helmet down and someone might want to pick it up later..just an idea. "SetCollisionEnabled" is your friend here I think :D
In your first image the client is interacting with the collision box and then destroying it. This will only happen on that client.
Then, image 2, the server puts the helmet on your client.
But nobody has told the other clients to destroy the collision box?
After the server puts the helmet on the client it needs to multicast to an event that destroys the collision box on all the clients. (you maybe should not even destroy the collision box at all on the first client that hits the collision box before calling the server).
What do you think? maybe?
answered Apr 10 '19 at 09:21 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here