I made a placement system where it makes you create blocks. However when i click it only stays the same place.
To get a clearer footage look at this link
Here's the local script;
local Button = script.Parent
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local IsAbleToSet = false
local Activated = false
local AggroMag = 50
local RemoteEve = game.ReplicatedStorage.RemoteEvent
local Decider = game.ReplicatedStorage.Dec
Button.Activated:Connect(function()
Decider.Parent = game.Workspace
Activated = true
Mouse.Move:Connect(function()
local PosX = Mouse.Hit.X
local PosY = 2
local PosZ = Mouse.Hit.Z
Decider:MoveTo(Vector3.new(PosX, PosY, PosZ))
local HumanoidRootPart = Player.Character.HumanoidRootPart
if (HumanoidRootPart.Position - Decider.Deciderb.Position).Magnitude > AggroMag then
IsAbleToSet = false
Decider.Deciderb.BrickColor = BrickColor.new("Really red")
else
Decider.Deciderb.BrickColor = BrickColor.new("Lime green")
IsAbleToSet = true
end
end)
Mouse.Button1Down:Connect(function()
if (IsAbleToSet == true and Activated == true) then
RemoteEve:FireServer(Decider)
end
end)
end)
Here's the script;
local RemoteEve = game.ReplicatedStorage.RemoteEvent
RemoteEve.OnServerEvent:Connect(function(player, Decider)
local Block = Instance.new("Part")
Block.Name = "Block"
Block.Size = Vector3.new(22.97, 15.38, 2)
Block.Anchored = true
Block.Material = Enum.Material.WoodPlanks
Block.BrickColor = BrickColor.new("Khaki")
Block.Parent = game.ReplicatedStorage
local NewBlock = Block:Clone()
NewBlock.Parent = game.Workspace
game.ReplicatedStorage.Dec.Deciderb.Position = Decider.Deciderb.Position
NewBlock.Position = game.ReplicatedStorage.Dec.Deciderb.Position
end)
