mc7oof
(oof)
December 20, 2024, 9:45pm
#1
I am sending mouse.Target through a Remote (when the player clicks on a specific part within a group).
I know how to confirm that the mouse.Target is a BasePart, but how do I confirm that the mouse.Target actually exists on the Server?
I don’t want exploiters sending false mouse.Targets (from fake parts) to trip up the Server script.
I tried using FindFirstChild(MouseTarget) but it doesn’t work because FindFirstChild wants a String.
I cannot convert the Instance to a string because every Instance in the folder has the same name.
1 Like
mc7oof
(oof)
December 20, 2024, 10:03pm
#3
Here is an example of what I mean.
CLIENT:
script.Parent.RemoteEvent:FireServer(mouse.Target, mouse.TargetSurface)
SERVER:
script.Parent.RemoteEvent.OnServerEvent:Connect(function(player, target, targetSurface)
if not target:IsA("BasePart") then warn("Not A BasePart") return end
— need to check if part really exists on the server
end)
0786ideal
(ideal)
December 20, 2024, 10:04pm
#4
No. if you create part on client and send it over remote server will tell nil
EDIT: check if part exist and if not return, you should be fine then
1 Like
sfgij
(sfgij)
December 20, 2024, 10:53pm
#5
just check if target then
, because if it doesn’t exist server sided then it’ll return nil if it does it should return true
1 Like
mc7oof
(oof)
December 20, 2024, 11:01pm
#6
Thanks @0786ideal and @sfgij !
You are both right.
I totally forgot I could test cloning a block on the client in Studio.
The line if not target:IsA("BasePart") then warn("Not A BasePart") return end
takes care of it since the item is nil
.
I didn’t know it would be nil
.
0786ideal
(ideal)
December 21, 2024, 11:59am
#7
I don’t reccomend using warn, simplu return, it may cause exploiters to spam print your output, also you don’t need to check if it’s basePart but rather if it exist
if not part then return end
mc7oof
(oof)
December 21, 2024, 1:49pm
#8
Thanks, I had not thought about spamming the output.
Those exploiters will do anything to mess up a game!
system
(system)
Closed
January 4, 2025, 1:49pm
#9
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.