(I had to shorten the title because of the stupid 100 char limit)
Hello! I'm having some troubles with my model placement, it clones the model but doesn't move it until you click again. AND doesn't clone another part. Help would be appreciated
FYI: I'm using remote events
Replicated storage(Ignore "changebuilding")
SERVER SCRIPT
local place = game:GetService("ReplicatedStorage").Placement.Remotes.Place game.ReplicatedStorage.Placement.Remotes.Place.OnServerEvent:Connect(function(plr, building, position) local building2 = building:Clone() building:MoveTo(position) building.Parent = workspace end)
LOCAL SCRIPT
local player = game:GetService("Players").LocalPlayer -- Define the player local mouse = player:GetMouse() -- Define the mouse local UIS = game:GetService("UserInputService") -- UIS for activate of placement local active = true -- Is placement active? local activekeycode = Enum.KeyCode.E -- When the player presses E, they start placement. local event = game:GetService("ReplicatedStorage").Placement.Remotes.Place local changeevent = game:GetService("ReplicatedStorage").Placement.Remotes.ChangeBuilding local currentbuilding = game:GetService("ReplicatedStorage").Placement.Buildings.Model --UIS.InputBegan:Connect(function(input, gp) Not in use --if input == activekeycode and gp and active then --active = true --else --active = false --end --end) mouse.Button1Down:Connect(function()--Start the placement --if active then -- Ensure it is active print("Activated") local building = currentbuilding local position = mouse.Hit.p -- Don't know if i should use "mouse.Hit.p" or "mouse.Hit" event:FireServer(building, position) --end end) -- IGNORE THIS!!!!!!!!!!!!!!!!! changeevent.OnClientEvent:Connect(function(building)-- Change building if not active and building ~= currentbuilding then -- Ensure it is not active currentbuilding = building end end)
The problem is on the server script:
local place = game:GetService("ReplicatedStorage").Placement.Remotes.Place game.ReplicatedStorage.Placement.Remotes.Place.OnServerEvent:Connect(function(plr, building, position) local building2 = building:Clone()--Cloned the original building building:MoveTo(position)--Original building was referenced instead of the clone, you moved the original building building.Parent = workspace--Same problem here, you moved the building to the workspace --Just change the building to building2 on lines 8 and 9 and you should be good to go end)