well kinda, the server clones it and spawn it in front of the player(that is solved)
but there is some problem with the delete script
Change it to
ClonedPart.Name = Player.Name.."'s_clone"
Could you send the delete script?
What you can do it name it, ofcourse
For example if the part is just called
foxnoobkite's_clone
You can just try and find it by saying
if player.Character:FindFirstChild(player.Name.."'s_clone") then
local part = player.Name.."'s_clone"
part:Destroy()
end
I may be wrong.
That will not work because part
would be a string, and because the part is cloned to a folder in workspace, not the playerâs character. If you scroll up youâll see the current code in his delete event, although slightly difference is that it also includes that sufix as well
Whoops, my mistake.
I do suggest try to find it & defining it.
there is no errors ;-;
local UIS = game:GetService("UserInputService")
local Character = script.Parent
local Pp = game.ReplicatedStorage:WaitForChild("Pp")
local Event = game.ReplicatedStorage:WaitForChild("RemoteEvent")
local CurrentParts = 0
UIS.InputBegan:Connect(function(Key, Chatted)
if Chatted or CurrentParts >= 1 then
return
end
if Key.KeyCode == Enum.KeyCode.E then
CurrentParts += 1
Event:FireServer()
end
if Key.KeyCode == Enum.KeyCode.Q and CurrentParts == 1 then
CurrentParts -=1
Pp:FireServer()
end
end)
Now this is causing your issue, because whe nyou make a part CurrentParts is 1, it wont continue anymore, remove the or CurrentParts >= 1
and change this
if Key.KeyCode == Enum.KeyCode.E then
To this
if Key.KeyCode == Enum.KeyCode.E and CurrentParts == 0 then
ima try it out later i have to go to school :> hope it works!
ummm i can spawn a lot of clones and I canât delete them
What is your current code in the client script as of now?
i fixed it now xd thx for helping tho
Hi! Can you share your script? It would be very helpful!
k, I modified it so that when u press Q it deletes the clone u made
local script in starter character
local UIS = game:GetService("UserInputService")
local Character = script.Parent
local Pp = game.ReplicatedStorage:WaitForChild("Pp")
local Event = game.ReplicatedStorage:WaitForChild("RemoteEvent")
local CurrentParts = 0
UIS.InputBegan:Connect(function(Key, Chatted)
if Chatted then
return
end
if Key.KeyCode == Enum.KeyCode.E and CurrentParts == 0 then
CurrentParts += 1
Event:FireServer()
end
if Key.KeyCode == Enum.KeyCode.Q and CurrentParts == 1 then
CurrentParts -=1
Pp:FireServer()
end
end)
in serverscripts
local Event = game.ReplicatedStorage:WaitForChild("RemoteEvent")
local Pp = game.ReplicatedStorage:WaitForChild("Pp")
Event.OnServerEvent:Connect(function(Player)
local Character = Player.Character
local HRP = Character:WaitForChild("HumanoidRootPart")
local ClonedPart = game.ReplicatedStorage.Part:Clone()
ClonedPart.Parent = workspace.Folder
ClonedPart.Name = Player.Name.."'s Noob"
ClonedPart:MakeJoints() --Still don't understand why this is deprecated
ClonedPart.PrimaryPart = ClonedPart.Torso --This is called first before calling the PrimaryPartCFrame function
ClonedPart:SetPrimaryPartCFrame(CFrame.new(HRP.CFrame.Position + (HRP.CFrame.LookVector * 5)))
end)
Pp.OnServerEvent:Connect(function(Player)
local part = workspace.Folder:FindFirstChild(Player.Name.."'s clone")
if not part then
return
end
part:Destroy()
end)