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

Stamper script not working?

So I made a script for a block that has a surface gui when placed, but when I place it the block doesn't have the gui on it. Here's the script:

wait(0.1)
local BG = Instance.new("SurfaceGui")
local P = script.Parent.Parent.Part
BG.CanvasSize = UDim2.new(130,100)
BG.Parent = P
BG.Face = ("Front")
BG.Adornee = P
local TL = Instance.new("TextLabel")
TL.Position = UDim2.new(0,63,0,50)
TL.TextColor3 = Color3.new(0,0,0)
TL.FontSize = Enum.FontSize.Size48
TL.Parent = BG
TL.Text = script.Parent.Parent.Properties.Text.Var.Value

script.Parent.Parent.Properties.Text.Var.Changed:connect(function()
	TL.Text = script.Parent.Parent.Properties.Text.Var.Value
end)

Help?

2 comments

0

You forgot to set the Parent for the SurfaceGui. :P

0

its there. look at lines 2 and 3 then at BG.Parent = P

1 answer

Maybe add a touch event to the block's script to imitate a PlaceEvent?

local connection = script.Parent.Touched:connect(function()
	-- Paste your code here.
	connection:disconnect()
end)

What I am doing here is that I am creating a touch event, storing the connection line as a variable, connection and after the event is fired, it means that the block has been placed, so I the event doesn't get called again, I simply disconnect the event.

1 comment

0

it didnt work...

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