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

Boat doesn't work when cloned?

Asked by 10 years ago

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

Log in to vote
1
Answered by 10 years ago
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.

0
Thx Operation_Meme 890 — 10y
0
May I get accepted? :D EzraNehemiah_TF2 3552 — 10y
0
Oh, i got another problem. (I did accept) the script wont work online. Operation_Meme 890 — 10y
0
Any output? EzraNehemiah_TF2 3552 — 10y
View all comments (15 more)
0
Let me see Operation_Meme 890 — 10y
0
says "Workspace.Part.ShipShop.TextButton.Script:2: attempt to index field "LocalPlayer" (a nil value)" Operation_Meme 890 — 10y
0
Is this script a Local Script? EzraNehemiah_TF2 3552 — 10y
0
Oh nvm! I just checked its a normal script. It needs to be local right? Operation_Meme 890 — 10y
0
Yep. And local scripts need to be in either Guis, tools, or hopperbins, or somewhere in a player. EzraNehemiah_TF2 3552 — 10y
0
Still wont work... Operation_Meme 890 — 10y
0
Hmm, anything else in the output? Or is that it? EzraNehemiah_TF2 3552 — 10y
0
let me check Operation_Meme 890 — 10y
0
Nope. Nothing in output Operation_Meme 890 — 10y
0
ik the problem Operation_Meme 890 — 10y
0
What was it? EzraNehemiah_TF2 3552 — 10y
0
Wait nvm. I thought i forgot to put it in the storage Operation_Meme 890 — 10y
0
Well, how would I know what? :\ ( y' _ ' )y EzraNehemiah_TF2 3552 — 10y
0
Well thx for helping. Operation_Meme 890 — 10y
0
We should stop commenting now. Bye. EzraNehemiah_TF2 3552 — 10y
Ad

Answer this question