Client sided script becoming server sided ingame

in my game we need to drag a key to unlock a door and i wanted to make it so the key cant collide with the player which the local script works wonderfully in studio

but my problem is whenever i test it ingame the key doesnt collide to anything in the game like if the script went from being client sided to server sided somehow?
Screenshot 2024-06-19 130026
Screenshot 2024-06-19 125832

ive searched through so many posts for this but cant find anything that helps

Is the key your trying to set can collide of unanchored?

cancollide is turned on for the key
Screenshot 2024-06-19 131222

Right there is your issue, the key is unanchored meaning the player probably has network ownership of it. Try making a script that sets the keys network owner to nil (the server)

sorry im still kind of a beginner i dont quite understand what you’re trying to suggest me to do

Make a server script inside the key and put this in it :

script.Parent:SetNetworkOwner(nil)
1 Like

thank you so much this fixed it :woot:

1 Like

This is not really hacking or exploiting but this video still covers network ownership if you don’t know about it Stop Hackers / Exploiters - Roblox Scripting Tutorial - YouTube

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.