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

((PLEASE HELP!!)) VIP breaks in play mode, works fine in Studio?

So I've been trying to add a new VIP to my VIP script (Haywires), but it breaks every other VIP that I have when I do it.. There are 4 VIPs and a section that gives you stuff if you have the 1st and 2nd one.

Going to reference every part that I edited:

Top of script:

local GPS = game:GetService("MarketplaceService")
local p = script.Parent.Parent.Parent.Parent.Parent

First section:

for i = 5, 1, -1 do
	for i,c in pairs(script.Parent:GetChildren()) do
		if c:IsA'ImageButton' then
			c.MouseButton1Click:connect(function()
				if GPS:PlayerOwnsAsset(p, script.Parent.Rex.Value) or GPS:PlayerOwnsAsset(p, script.Parent.Sat.Value) or GPS:PlayerOwnsAsset(p, script.Parent.Fusion.Value) or GPS:PlayerOwnsAsset(p, script.Parent.Haywires.Value) then
				local doteleport = false
				local db = script.Parent.Parent:WaitForChild'DB'
				if (db.Value == true) then return end--So people can't spam character looks.
				db.Value = true
				repeat wait() until p.Character
				local char = p.Character
				local h = p.Character:WaitForChild'Humanoid'
				local suits = game.ReplicatedStorage.Suit_Data
				local tools = game.ReplicatedStorage.Game_Tools

Second section:

				--Give Tools.
				if game.ReplicatedStorage.Game_Tools:FindFirstChild(suit.Tools.Value) then
					---So VIP's work.
					if c.VipType.Value == 1 and GPS:PlayerOwnsAsset(p, script.Parent.Rex.Value) then
					for _,v in pairs(game.ReplicatedStorage.Game_Tools[suit.Tools.Value]:GetChildren()) do
					if v:IsA("HopperBin") or v:IsA("Tool") then
					print("REXVIP")
					v:clone().Parent = p.Backpack
					instancethehats()
					doteleport = true
					end
					end
					end 
					
					if c.VipType.Value == 2 and GPS:PlayerOwnsAsset(p, script.Parent.Sat.Value) then
					for _,v in pairs(game.ReplicatedStorage.Game_Tools[suit.Tools.Value]:GetChildren()) do
					if v:IsA("HopperBin") or v:IsA("Tool") then
					print("SATVIP")
					v:clone().Parent = p.Backpack
					instancethehats()
					doteleport = true
					end
					end 
					end 
					
					if c.VipType.Value == 3 and GPS:PlayerOwnsAsset(p, script.Parent.Fusion.Value) then
					for _,v in pairs(game.ReplicatedStorage.Game_Tools[suit.Tools.Value]:GetChildren()) do
					if v:IsA("HopperBin") or v:IsA("Tool") then
					print("FUSIONVIP")
					v:clone().Parent = p.Backpack
					instancethehats()
					doteleport = true
					end 
					end 
					end 
					
					if c.VipType.Value == 4 and GPS:PlayerOwnsAsset(p, script.Parent.Haywires.Value) then
					for _,v in pairs(game.ReplicatedStorage.Game_Tools[suit.Tools.Value]:GetChildren()) do
					if v:IsA("HopperBin") or v:IsA("Tool") then
					print("HAYWIREVIP")
					v:clone().Parent = p.Backpack
					instancethehats()
					doteleport = true
					end 
					end 
					end 
					
					if c.VipType.Value == 5 and GPS:PlayerOwnsAsset(p, script.Parent.Rex.Value) and GPS:PlayerOwnsAsset(p, script.Parent.Sat.Value) then
					for _,v in pairs(game.ReplicatedStorage.Game_Tools[suit.Tools.Value]:GetChildren()) do
					if v:IsA("HopperBin") or v:IsA("Tool") then
					print("ALL VIP")
					v:clone().Parent = p.Backpack
					instancethehats()
					doteleport = true
					end 
					end 
					end
							
					if GPS:PlayerOwnsAsset(p, script.Parent.Rex.Value) or GPS:PlayerOwnsAsset(p, script.Parent.Sat.Value) or GPS:PlayerOwnsAsset(p, script.Parent.Fusion.Value) or GPS:PlayerOwnsAsset(p, script.Parent.Haywires.Value) then
						if doteleport then
						local pos = teles[math.random(1, #teles)].Position
						p.Character.Humanoid.Jump = true
						wait(0.25)
						char:WaitForChild'Torso'.CFrame = CFrame.new(Vector3.new(pos.X, pos.Y+3, pos.Z))
					end

What could be the problem? Sorry if it's kind of vague, but I have no idea what's causing it to break just by copying and pasting already working parts.. (GPS:PlayerOwnsAsset(p, script.Parent.Haywires.Value) Also, it IS a LocalScript, I AM using different Id variables for each pass, and getting no errors either in play mode..

I tried using prints and none of them get through in play mode but they do in Studio. Makes no sense.

10 comments

0

I've had the same problem, it works in studio, but not online wtf?

0

Yeah, and this makes no sense: I copy and paste WORKING lines that worked in both Studio and Play mode before, but just adding an extra line breaks it in Play mode but it works fine in Studio? UMMM what??

0

When you play the game in play mode press f9 and see if there is any output

0

Oh srry didn't notice the bottom half

0

Yeah I mentioned everything I have tried, so what now?

0

In play mode it just does nothing - no errors or anything.

0

LuckyAura it's not helpful to say nothing except that it's broken and post 80 lines of code. No one can help with that. Explain what was supposed to happen that did not, and walk through the script.

0

OK... That isn't helpful either lol.. It's supposed to teleport you to a map, load your character, give you tools, etc... It's in the script??

0

What part of the code isn't working? When it gets to the character loading section? Or when it gets to the tools giver section? What is it stopping at? Does it not do anything & just sit there when the game starts? Your replies are very vague.

0

They're vague cause I have no idea why it isn't working.. I said above that ADDING THE HAYWIRE PARTS breaks the entire VIPs. Without the Haywire part, all the others work, which makes no sense since it should work since I just copied and pasted stuff. I don't know what it stops at.. I don't think the script even runs in Play mode.

1 answer

✓ Accepted answer

Hey there.

Sometimes, scripts are executed before anything is loaded at all.

To prevent this, just put wait(1) all the way at the top of both scripts.

If this works, let me know.

Thanks, ~script_ing,

2 comments

0

I can't believe it was that simple, and took so long for someone to say that! Lol thank you so much!! :-)

0

No problem.

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