I am trying to make a Place Traffic Cone system for my game, And I can’t get the Server Script correct, It says there’s an error with the script with adding the Cones Position. I was wondering if somebody could help me out with this.
Script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Tools = ReplicatedStorage:WaitForChild("Tools")
Tools.PlaceCone.OnServerInvoke = function(Player, ConePlacement)
if not Player or not ConePlacement then
return
end
local ConeTemplate = Tools.Cones:Clone()
local ConesFolder = Instance.new("Folder")
ConesFolder.Name = Player.Name .. "'s Cones"
ConesFolder.Parent = game.Workspace
ConeTemplate.Parent = ConesFolder
ConeTemplate.CFrame = CFrame.new(ConePlacement)
return "Success"
end
remote events and functions automatically define the first argument as the player who invoked the event, replace the line on the server script with .OnServerInvoke = function(Player, parentname, ConePlacement)
what exactly is Parent.Name supposed to be and why are you sending it? it doesnt seem like youre using it so you can just remove it, either that or add that extra argument on the server script that i said above
when you Invoke the server, it should already send over the player as the first parameter. In your .OnServerInvoke, you should define the player, coneplacement, and the CFrame.
It should be something like .OnServerInvoke(player, objectname, objectCFrame)
Basically you need to define the all of the messages sent from the client. Im not sure what you need the name of the object for but you have to define it in their server script if you send it over from the client
The reason you are getting the “vector3 expected, got string” is because you are only sending the objectname over and not the CFrame value. (Hopefully this makes sense in typing this on mobile)