I thought there was a simple way to do something like this but it’s been a while for me. Anyway I want the server to give the client control over an objects position. Is the best way to do this really to just have the client spam a remote event with the objects position? I thought there was a simpler way to give control, but also I don’t want the player to be able to delete/modify the object aside from its position.
Are you referring to physics? You can use network ownership.
WARNING! THIS IS SERVER SCRIPTS ONLY!
Try this:
function SetOwner(Player, Part)
if Part:IsA("BasePart") then
print("Is a BasePart")
if Player then
Part:SetNetworkOwner(Player)
print("Set Network Owner to client!")
else
warn("Player doesn't exist! setting owner to server!")
Part:SetNetworkOwner()
print("Set Network Owner to server!")
end
else
warn("Not a BasePart!")
end
end
-- Call these anytime:
local Plr = game:GetService("Players"):FindFirstChild("Kripicial") -- Replace this
local Part = script.Parent or workspace.Part -- Replace this
SetOwner(Plr, Part)
Thanks ya network ownership is what I was talking about. Will this allow cheaters to resize the parts? Or will they only have control over how it moves?
The hugest issue with giving the client control is that exploiters can control everything not on the server, so if you do this then you are risking an exploiter messing with the part, they can’t resize the part for everyone, but it will behave like it is.
Edit: Like for example the part is a sphere, but it acts like a cube the size of the whole map because the person you gave control to is injecting code that is making the part huge on their end.
Edit2: If you give the client control like this there is nothing you can do without RemoteEvents that the exploiters can ALSO take advantage of if you are not careful.
So is it acceptable to pretty much spam the server with a remote event to update the objects position only? I just figured that would be pretty inefficient but I’m unsure. How many times per second can you even ping the server with a remote event from 1 client?
as fast as game:GetService("RunService").Heartbeat
goes (I think) and that should make it seamless. also, if it is already being sent every frame Exploiters cannot abuse it much.
Make sure that the network owner is the Server so they can’t abuse it!
Roblox automatically makes the closest player of an unanchored part the network owner!
How do I do it?
You can do this easily:
Part:SetNetworkOwner()
Or as most people do, but does the same thing:
Part:SetNetworkOwner(nil)
Didn’t know that about unanchored parts so thank you. All the parts in the game I’m working on now though will be anchored. Guess I’ll just use remote events thanks.
I’m glad to of helped you.
also, game link?
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.