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

Stamper script not working?

Asked by 10 years ago

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?

0
You forgot to set the Parent for the SurfaceGui. :P TheeDeathCaster 2368 — 10y
0
its there. look at lines 2 and 3 then at BG.Parent = P VentusWind78 25 — 10y

1 answer

Log in to vote
0
Answered by
war8989 35
10 years ago

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.

0
it didnt work... VentusWind78 25 — 10y
Ad

Answer this question