Recommendations
You should always use :GetService even if you can define the service from the DataModel. Why? Because :GetService can still retrieve the service even if you were to change the name. The workspace is different, there's a global variable known as Workspace or workspace.
You should change the properties of an instance first, then the last thing you should do is parent it, this can increase the performance of your game.
Fixed Script
local click = script.Parent
local block = game:GetService("ReplicatedStorage").test
click.MouseClick:Connect(function(playerThatClicked)
local cloneBlock = block:Clone()
cloneBlock .Position = Vector3.new(69.971, 38.673, -244.463)
cloneBlock .Parent = workspace
end)
Explanation
Removed the button variable because you had two variables that had the same value.
From my POV, the click variable is a ClickDetector. The MouseClick event of the ClickDetector has a parameter which is the PlayerThatClicked.
So, after that, I created a variable for that the cloned Instance. Usually, when I just want to parent it to the workspace, I would do block:Clone().Parent = workspace I would do it in one line, but for this case, you want to change the position so, you have to create a variable.
Then, the last are changing the Position and parenting it.
Also, I'm confused why you created variables that had the same value.
1 comment
Can you put your code in a code block.