i am trying to make a game were you are clicking to make a frame (very weird) and i am trying to make that it would copy the frame from server storage and paste it into starter gui but it dosent work if u have any solution let me know
01 | local Players = game:GetService( "Players" ) |
02 | local player = Players.LocalPlayer |
03 | local mouse = player:GetMouse() |
04 | local Object = game.ServerStorage.Dot |
05 | local copy = Object:Clone() |
06 |
07 |
08 | mouse.Button 1 Down:Connect( function () |
09 | copy = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame |
10 | copy.Position = UDim 2. new( 0 ,mouse.X - 10 , 0 ,mouse.Y + 25 ) |
11 | end ) |
You should put your copy clone variable in the function so every time you click, it clones it instead of cloning ONLY ONCE
01 | local Players = game:GetService( "Players" ) |
02 | local player = Players.LocalPlayer |
03 | local mouse = player:GetMouse() |
04 | local Object = game.ServerStorage.Dot |
05 |
06 |
07 | mouse.Button 1 Down:Connect( function () |
08 | local copy = Object:Clone() |
09 | copy.Parent = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame |
10 | copy.Position = UDim 2. new( 0 ,mouse.X - 10 , 0 ,mouse.Y + 25 ) |
11 | end ) |
You also instead of defining copy clone's Parent, you instead redefined the copy variable as an Instance location. Hope that solves your issue! :)
Seems like you forgot to add ".Parent" in line 9
1 | copy.Parent = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame |
But if u need to copy your object more than once, u have to put
1 | local copy = Object:Clone() |
into function.