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

Boat doesn't work when cloned?

I made a boat shop using a surface gui, and it clones the boat into workspace from replicated storage. But whenever the boat gets cloned into workspace, it all falls apart. I made the surface welds. It works when I don't clone it. Script:

script.Parent.MouseButton1Click:connect(function(buy)
	if game.Players.LocalPlayer.leaderstats.Beli.Value >= 50 and game.Players.LocalPlayer.ShipGot.Value == false then
	l = game.ReplicatedStorage.Boat:Clone()
	l.Parent = game.Workspace
	l.Name = ""..game.Players.LocalPlayer.Name
	game.Players.LocalPlayer.leaderstats.Beli.Value = game.Players.LocalPlayer.leaderstats.Beli.Value - 50
	end
end)

1 answer

✓ Accepted answer
script.Parent.MouseButton1Click:connect(function(buy)
    if game.Players.LocalPlayer.leaderstats.Beli.Value >= 50 and game.Players.LocalPlayer.ShipGot.Value == false then
local l = game.ReplicatedStorage.Boat:Clone()
    l.Parent = game.Workspace
    l.Name = game.Players.LocalPlayer.Name
l:MakeJoints() --See if this works.
    game.Players.LocalPlayer.leaderstats.Beli.Value = game.Players.LocalPlayer.leaderstats.Beli.Value - 50
    end
end)

You use :MakeJoints() to clone things like NPCs or things that need to be welded and have welds. Most respawn scripts have :MakeJoints() in it.

19 comments

0

Thx

0

May I get accepted? :D

0

Oh, i got another problem. (I did accept) the script wont work online.

0

Any output?

0

Let me see

0

says "Workspace.Part.ShipShop.TextButton.Script:2: attempt to index field "LocalPlayer" (a nil value)"

0

Is this script a Local Script?

0

Oh nvm! I just checked its a normal script. It needs to be local right?

0

Yep. And local scripts need to be in either Guis, tools, or hopperbins, or somewhere in a player.

0

Still wont work...

0

Hmm, anything else in the output? Or is that it?

0

let me check

0

Nope. Nothing in output

0

ik the problem

0

What was it?

0

Wait nvm. I thought i forgot to put it in the storage

0

Well, how would I know what? :\ ( y' _ ' )y

0

Well thx for helping.

0

We should stop commenting now. Bye.

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