Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Workspace cannot be cloned server script help?

Asked by 2 years ago

model = script.Parent.Parent--Indicates that the script interacts with the model the button is grouped with. messageText = "Regenerating Heli"--If you want a message to appear upon pressing, type it here.

message = Instance.new("Message") message.Text = messageText backup = model:clone() enabled = true

function regenerate() message.Parent = game.Workspace model:remove()

wait(0.001)--Change this number to display the regen message as long as you want in seconds.

model = backup:clone()
model.Parent = game.Workspace
model:makeJoints()
message.Parent = nil

script.Disabled = true
script.Parent.BrickColor = BrickColor.new(26)--Black
wait(0.01)--Change this number to change the time in between regenerations via the button, in seconds..
script.Parent.BrickColor = BrickColor.new(104)--Purple
script.Disabled = false

end

function onHit(hit) if (hit.Parent:FindFirstChild("Humanoid") ~= nil) and enabled then regenerate() end end

script.Parent.Touched:connect(onHit)

1 answer

Log in to vote
0
Answered by 2 years ago

Don't mind this I just make it so that I can read the script better.

model = script.Parent.Parent--Indicates that the script interacts with the model the button is grouped with. messageText = "Regenerating Heli"--If you want a message to appear upon pressing, type it here.

message = Instance.new("Message") message.Text = messageText backup = model:clone() enabled = true

function regenerate() message.Parent = game.Workspace model:remove()

wait(0.001)--Change this number to display the regen message as long as you want in seconds.

model = backup:clone()
model.Parent = game.Workspace
model:makeJoints()
message.Parent = nil

script.Disabled = true
script.Parent.BrickColor = BrickColor.new(26)--Black
wait(0.01)--Change this number to change the time in between regenerations via the button, in seconds..
script.Parent.BrickColor = BrickColor.new(104)--Purple
script.Disabled = false
end

function onHit(hit) if (hit.Parent:FindFirstChild("Humanoid") ~= nil) and enabled then regenerate() end end

script.Parent.Touched:connect(onHit)
0
Nahhh, so you transfer the script to another location. because of that the first variable which is "model" became the workspace. To solve your problem you need to change the location to tell the script about the location of the model. I want to see a screenshot so I can do it myself, send a message on my fb account.my name is Jerald Diasnes AltairCelestia 47 — 2y
Ad

Answer this question