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

Can anyone tell me the problem?

I made this script earlier to use on my Starship. I apologise for the messiness. When I activate the script, it does nothing and the output says nothing. The script itself checks if a value is set to a certain place, then grabs the "warp" from ServerStorage into Workspace for 12 seconds, destroys it, then takes the place from ServerStorage and puts it in Workspace. The output does not display the print right after function warp(), so I believe there may be a problem in how I'm calling it. But it works for other GUI TextButtons.

function warp()
print("hi!")
if game.Workspace.EngineeringDeck.Core.Ejected ~= true then
	if game.Workspace:FindFirstChild("warp") == nil then
		game.Workspace.BridgeDeck.Bridge.Helm.Part.Sound.Pitch = 1
		game.Workspace.BridgeDeck.Bridge.Helm.Part.Sound:play()
		script.Parent.Parent.Parent.Parent:Destroy()
		wait(7)
		local c = game.ServerStorage.warp:Clone()
		c.Parent = game.Workspace
		wait(12)
	if game.Workspace:FindFirstChild("Spacedock") == nil and game.Workspace.BridgeDeck.Bridge.Helm.Part.Value.Value == "Earth Spacedock" then
		if game.Workspace:FindFirstChild("Planet")~= nil then
			game.Workspace.Planet:destroy()
		end
		if game.Workspace:FindFirstChild("Drydock")~= nil then
			game.Workspace.Drydock:destroy()
		end		
		local sd = game.ServerStorage.Spacedock:Clone()
		sd.Parent = game.Workspace
end
	if game.Workspace:FindFirstChild("Planet")== nil and game.Workspace.BridgeDeck.Bridge.Helm.Part.Value.Value == "Planet" then
		if game.Workspace:FindFirstChild("Spacedock")~= nil then
			game.Workspace.Spacedock:destroy()
		end
		if game.Workspace:FindFirstChild("Drydock") ~= nil then
			game.Workspace.Drydock:destroy()
		end
		local p = game.ServerStorage.Planet:Clone()
		p.Parent = game.Workspace
		end
	end
	if game.Workspace:FindFirstChild("Drydock")== nil and game.Workspace.BridgeDeck.Bridge.Helm.Part.Value.Value == "Drydock" then
		if game.Workspace:FindFirstChild("Spacedock")~= nil then
			game.Workspace.Spacedock:destroy()
		end
		if game.Workspace:FindFirstChild("Planet") ~= nil then
			game.Workspace.Planet:destroy()
		end
		local dd = game.ServerStorage.Drydock:Clone()
		dd.Parent = game.Workspace
		end
end
	if game.Workspace.BridgeDeck.Bridge.Helm.Part.Value.Value == "Drydock" then
		if game.Workspace:FindFirstChild("Spacedock")~= nil then
			game.Workspace.Spacedock:destroy()
		end
		if game.Workspace:FindFirstChild("Planet") ~= nil then
			game.Workspace.Planet:destroy()
		end
		if game.Workspace:FindFirstChild("Drydock") ~= nil then
			game.Workspace.Planet:destroy()
	
	else return end
		game.Workspace.Bridge.BridgeDeck.Helm.Sound.Pitch = 5
		game.Workspace.Bridge.BridgeDeck.Helm.Sound:play()
		wait(1.4)
		game.Workspace.warp:destroy()
else
	script.Parent.wrong:Play()
end
end




script.Parent.MouseButton1Click:connect(warp)

Can anyone help?

3 comments

1

Don't just give us a huge code and expect us the fix it. Tell us about where the error is located.

0

Don't post a comment on my question without reading it or even the title. I would have thought "Can anyone tell me the problem" would suggest that I don't KNOW the error. And as I've said, I think the problem is with how I'm calling it. Please READ next time instead of being indignant.

0

If that print isn't working, then the problem isn't in the code you gave us. Also, try to properly indent your code. You've done some, but there are places it could be better. It'll help us give you an answer faster.

1 answer

You can try:

script.Parent.MouseButton1Down:connect(warp)

That is just for calling the function, I haven't gone over your whole script

1 comment

0

Also if there is any other code included in this script, that might be causing the problem.

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