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

This Local Script works in Studio, why not in Game?

Asked by 10 years ago

I have this script:

01local c = nil
02local sB = script.Parent.SetButton
03local rB = script.Parent.RemoveButton
04local char = game.Players.LocalPlayer.Character
05 
06sB.MouseButton1Click:connect(function()
07    c = char.Torso.CFrame
08    if(char.LocalBin:FindFirstChild("WaypointMarker")) then char.LocalBin.WaypointMarker:Destroy() end
09    m = game.Lighting.WaypointMarker:Clone()
10    m.CFrame = c
11    m.Parent = char.LocalBin
12end)
13rB.MouseButton1Click:connect(function()
14    char.LocalBin.WaypointMarker:Destroy()
15end)

Just to clarify the waypoint marker is a Part with a Script inside it that makes it spin, also sB and rB are text buttons. What it does is once you click the button it clones the Part to your Torso and then once you click the second button it removes it. If you click the second button twice it removes the first Part. This works fine in Studio but the Part doesn't show up in the actual game. At the moment you can test it here.

1 answer

Log in to vote
1
Answered by 10 years ago

.

01local c = nil
02local sB = script.Parent.SetButton
03local rB = script.Parent.RemoveButton
04local char = game.Players.LocalPlayer.Character
05 
06sB.MouseButton1Click:connect(function()
07    c = char.Torso -- you cannot call a CFrame without CFraming anything, so we just call the part
08    if(char.LocalBin:FindFirstChild("WaypointMarker")) then char.LocalBin.WaypointMarker:Destroy() end
09    m = game.Lighting.WaypointMarker:Clone()
10    m.CFrame = c.CFrame -- we add CFrame here
11    m.Parent = char.LocalBin
12end)
13rB.MouseButton1Click:connect(function()
14    char.LocalBin.WaypointMarker:Destroy()
15end)
0
Also, Ingame, Press F9 to view debug console to see if it prints any errors. killerkill29 35 — 10y
0
It is a Gui -_- Norshine 88 — 10y
0
You mentioned that it is a part.. killerkill29 35 — 10y
0
No, I mentioned that the WaypointMarker is a part, I'm not calling MouseButton1Click on WaypointMarker Norshine 88 — 10y
0
There we go, that should work(edited answer) killerkill29 35 — 10y
Ad

Answer this question