i am trying to send CFrame from server script to ModuleScript Located in Replicated Storage
I can’t pass it for some reason
server side:
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TryPlace = ReplicatedStorage.TryPlace
local placeableObjects = ReplicatedStorage.PlaceableObjects
local PlacementValidator = require(ReplicatedStorage.PlacementValidator)
function Place(player: Player, name: string, targetCF: CFrame): boolean
local object = placeableObjects:FindFirstChild(name)
if not object then
warn("Object not found:", name)
return false
end
local objectSize = object:GetExtentsSize()
local simpleCFrame = CFrame.new(0, 0, 0) -- Test with a simple CFrame
local success = PlacementValidator.NotIntersectingObjects(objectSize, "simpleCFrame")
warn("Test with simple CFrame:", success)
if not PlacementValidator.WithinBounds(objectSize, targetCF)
or not PlacementValidator.NotIntersectingObjects(objectSize, targetCF) then
warn("Placement failed due to bounds or intersection issues.")
return false
end
local newObject = object:Clone()
newObject:PivotTo(targetCF)
newObject.Parent = game.Workspace.PlacedProducts
warn("Object successfully placed!")
return true
end
Module Script:
local PlacementValidator = {}
function PlacementValidator.WithinBounds(_, objectSize: Vector3, worldCF: CFrame)
-- No longer checks bounds; always returns true for now
return true
end
function PlacementValidator.NotIntersectingObjects(_, objectSize: Vector3, worldCF: CFrame)
-- Check if worldCF is valid (not nil)
if not worldCF then
warn("Received nil CFrame in NotIntersectingObjects")
return false -- Return false to indicate failure in intersection check
end
if not worldCF.Position then
warn("Invalid Position in CFrame:", worldCF)
return false
end
local parts = workspace:GetPartBoundsInBox(worldCF.Position, objectSize)
return #parts == 0
end
return PlacementValidator
please can someone explain me why?