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

Guis dont work?

Hi, I have got a big problem, because i made script (spawner of car) and local script (wich is mading guis with buttons) Ok, let me first write source. Local script placed in StarterGui (Don't calling event (I think guis dont work but im not sure, i made all with guis good))

for _, i in pairs(game.Workspace:GetChildren()) do
	if string.sub(i.Name, 1, 6) == "Hangar" then
		local CustomCarSG = i.Script.SurfaceGuiC:Clone()
		CustomCarSG.Parent = script.Parent
		CustomCarSG.Adornee = i.SpawnerC
		CustomCarSG.TextButton.MouseButton1Click:connect(function() i.Script.SpawnCar:Invoke("Car", script.Parent.Parent.Name) end)
		local KBCarSG = i.Script.SurfaceGuiKB:Clone()
		KBCarSG.Parent = script.Parent
		KBCarSG.Adornee = i.SpawnerKB
		KBCarSG.TextButton.MouseButton1Click:connect(function() i.Script.SpawnCar:Invoke("CarKB", script.Parent.Parent.Name) end)
		local ToolSG = i.Script.SurfaceGuiT:Clone()
		ToolSG.Parent = script.Parent
		ToolSG.Adornee = i.SpawnerTools
		ToolSG.TextButton.MouseButton1Click:connect(function() i.Script.GiveItems:Invoke(script.Parent.Parent.Name) end)
		local CustomCarSG = i.Script.SurfaceGuiC:Clone()
		CustomCarSG.Parent = script.Parent
		CustomCarSG.Adornee = i.SpawnerC
		CustomCarSG.TextButton.MouseButton1Click:connect(function() i.Script.Spawn:Invoke("Car", script.Parent.Parent.Name) end)
	end
end

Script placed in Hangar model

-------------------------------
-- Made by kurka123
-- 2016/02/18
-- KB Race Championships 2016
-------------------------------
while true do
	if script:FindFirstChild("GetBigDoorStyle") then
		if script:FindFirstChild("SetBigDoorStyle") then
			if script:FindFirstChild("GetDoorStyle") then
				if script:FindFirstChild("SetDoorStyle") then
					if script:FindFirstChild("SpawnCar") then
						if script:FindFirstChild("GiveItems") then
							break
						end
					end
				end
			end
		end
	end
	wait(1)
end
local bigdoor = true
local door = true
wait(2)
print("Loaded script of "..script.Parent.Name)
script.SpawnCar.OnInvoke = function(item, plrname)
	print("Spawning "..item.." in "..script.Parent.Name)
	local i = game.Lighting:FindFirstChild(script.Parent.Name):FindFirstChild(item):Clone()
	i.Parent = game.Workspace
	local o = Instance.new("StringValue", i)
	o.Name = "CarOwner"
	o.Value = plrname
	i:MakeJoints()
end
script.GiveItems.OnInvoke = function(plr)
	for _, i in pairs(game.Lighting.CustomingItems:GetChildren()) do
		local tool = i:Clone()
		tool.Parent = game.Players:FindFirstChild(plr).Backpack
	end
end

script.GetBigDoorStyle.OnInvoke = function()
	return bigdoor -- true = closed
end
script.GetDoorStyle.OnInvoke = function()
	return door -- true = closed
end

script.SetBigDoorStyle.OnInvoke = function(type)
	if type == true or type == false then
		bigdoor = type
		if type == true then
			script.Parent.BigDoor.Transparency = 0
			script.Parent.BigDoor.CanCollide = true
		elseif type == false then
			script.Parent.BigDoor.Transparency = 1
			script.Parent.BigDoor.CanCollide = false
		end
	end
end

script.SetDoorStyle.OnInvoke = function(type)
	if type == true or type == false then
		door = type
		if type == true then
			script.Parent.Door.Transparency = 0
			script.Parent.Door.CanCollide = true
		elseif type == false then
			script.Parent.Door.Transparency = 1
			script.Parent.Door.CanCollide = false
		end
	end
end

Ok heres problem: I can call event (Script number 2) from developer console and it works but if i try clicking surface gui it dont works. PS Theres no error in developer console. SurfaceGui Properties: Active: True Adornee: Nil (setting in script number 1) CanvasSize: 500,200 ClassName: SurfaceGui Enabled: True Face: Front Name: SurfaceGuiKB ToolPunch....: 10 Archivable: True

TextButton in SurfaceGui: AbsolutePosition: 0,0 AbsoluteSize: 500,200 Active: True AutoButtonColor: True BackgroundColor3: 255,255,255 BackgroundTransparency: 1 BorderColor3: 27,42,53 BorderSizePixel: 0 ClassName: TextButton Modal: False Name: TextButton Parent: SurfaceguiKB Position: 0,0,0,0 Rotation: 0 Selectable: True Selected: False Size: 0,500,0,200 SizeConstraint: RelativeXY Style: Custom Visible: True ZIndex: 1 Font: Arial FontSize: Size14 Text: Spawn KB car TextBounds: 77,14 TextColor3: 0,0,0 TextFits: True TextScaled: True TextStrokeColor3: 255,255,255 TextStrokeTransparency: 0 TextTransparency: 0 TextWrapped: True TextXAlignment: Center TextYAlignment: Center Archivable: True ClipsDescendants: False Draggable: False NextSelection***: nil

1 comment

0

Oh and i forgot to say it works in studio but in roblox player no

1 answer

Found Error. BindableFunction Can't be called from Player

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