Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

What is wrong with this cloning script?

What is wrong with this script?

local player = game.Players.LocalPlayer
function onTouch()

if player.PlayerGui.Ready.Value == true then

if player.ds.Worn1.Value == 1 then
local clone = game.ServerStorage.Scripts.Clone.Animals.Test:Clone()
clone.Parent = player.Character

player.PlayerGui.Ready.Value = false
end
end
end

script.Parent.Touched:connect(onTouch)

3 comments

0

It seems as if one of the if statements is not firing so the code will not occur

0

Is this a localscript?

0

It is not a local script, though I tried with local script but still didn't work

1 answer

function onTouch(Brick)
local Player  =
Brick.Parent:findFirstChild("Humanoid")
if Player.PlayerGui.Ready.Value == true then

if Player.ds.Worn1.Value == 1 then
local clone = game.ServerStorage.Scripts.Clone.Animals.Test:Clone().Parent = Player.Character

Player.PlayerGui.Ready.Value = false
end
end
end

script.Parent.Touched:connect(onTouch)

4 comments

0

Something is not right in line 7 :(

0

I edited the script try it now.

0

Still there seems to be something wrong in line 7 as the "Parent = player.Character", the "=" is marked red.

0

Try now, The Local said "Player" But in the script I put "player" I fixed it now, so it should work.

This discussion is preserved as it was. New answers, comments, and votes are closed.