So my issue is that at the moment, I am looking to input the CFrame of a locally created object into a Remote Event’s parameters in order to create a part on the server. The CFrame information is sent into a module script which then activates the remote event with the CFrame parameter that was sent into the module script. When I input the CFrame I receive this error:
09:07:02.199 - ReplicatedStorage.3PMS:313: attempt to index nil with 'CFrame'
Here is a video of the code in action:
Here is the the part of the Local Script that is sending the information that creates the block to the module Script:
player = game.Players.LocalPlayer
mouse = player:GetMouse()
button = script.Parent
text = button.Text
repstor = game.ReplicatedStorage
partfolder = repstor.PartFolder
startGui = script.Parent.Parent.Parent
Run = game:GetService("RunService")
UIS = game:GetService("UserInputService")
guimod = require(repstor.Modules.GuiMod)
pms = require(game.ReplicatedStorage["3PMS"])
pms:Place(player, mouse, button, text, repstor, partfolder, startGui, Run, UIS)
Here is the part of the Module Script that is sending the received CFrame information into a remote event:
BPRE = game.ReplicatedStorage:WaitForChild("BloPlaRE")
UIS.InputBegan:Connect(function(input)
if hovering == false then
if SpawnEnabled == true then
if input.UserInputType == Enum.UserInputType.MouseButton1 then
bcf = block.CFrame
bp = block.Position
BPRE:FireServer(text, bcf, bp)
end
end
end
end)
end
The term “block” represents the wedge from the earlier video and is created locally for only the local player to see.
Here is the remote event:
BPRE = Instance.new("RemoteEvent")
BPRE.Name = "BloPlaRE"
BPRE.Parent = game.ReplicatedStorage
run = game:GetService("RunService")
BPRE.OnServerEvent:Connect(function(plr, label, cf, pos)
for i, v in pairs(game.ReplicatedStorage.PartFolder:GetDescendants()) do
if v.Name == label then
print(label)
if v:IsA("Part") or v:IsA("MeshPart") then
BuildBlock = v:Clone()
BuildBlock.Transparency = 0
BuildBlock.Name = label
BuildBlock.Parent = game.Workspace.PlotBlocks
BuildBlock.CFrame = cf
BuildBlock.Anchored = true
BuildBlock.CanCollide = false
hb = BuildBlock:WaitForChild("HitBox")
hb.CFrame = BuildBlock.CFrame
hb.Anchored = true
hb.CanCollide = false
hb.Position = pos
print(BuildBlock)
end
end
end
end)
I am looking for a way to input the CFrame from a locally created object into a remote event on the server.