Clone not working multiple times?
When two players use this code, it only clones the part once and the scripts both use that same part for their needs. Does anyone know why this would happen?
Local script in StarterPlayerScripts:
01 | local Players = game:GetService( "Players" ) |
02 | local LocalPlayer = Players.LocalPlayer |
03 | local Mouse = LocalPlayer:GetMouse() |
04 | local RepStorage = game:GetService( "ReplicatedStorage" ) |
05 | local DeletePart = RepStorage.DeletePart |
06 | local UIS = game:GetService( "UserInputService" ) |
08 | UIS.InputBegan:Connect( function (input) |
09 | local Hitposition = Mouse.Hit |
11 | if input.KeyCode = = Enum.KeyCode.R then |
13 | DeletePart:FireServer(Hitposition) |
Normal script in ServerScriptService:
01 | local RepStorage = game:GetService( "ReplicatedStorage" ) |
02 | local DeletePart = RepStorage.DeletePart |
03 | local Cube = RepStorage.Cube:Clone() |
05 | local ExploP = RepStorage.WhiteExplosion |
07 | DeletePart.OnServerEvent:Connect( function (Player, Position) |
08 | if Cooldown [ Player.name ] then return warn(Player.Name.. " is on cooldown" ) end |
09 | Cooldown [ Player.Name ] = os.time |
10 | Cube.Name = string.format( "%s part" , tostring (Player.name)) |
11 | Cube.Parent = game.Workspace |
12 | Cube.CFrame = Position |
17 | Cube.Size = Vector 3. new(i+ 5 ,i+ 5 ,i+ 5 ) |
22 | ExploP.Parent = RepStorage |
23 | Cube.Parent = RepStorage |
25 | Cooldown [ Player.Name ] = nil |