So I am making a button prompted door opening script, I have my screen gui in the starter gui, the billboard gui and its text label inside the screen gui. However when I walk up to the door there is one gui which is correctly placed on the door and another one which is weirdly positioned on the baseplate behind the door, how do I get rid of the one on the baseplate?
1 Like
I might be able to help. Can you provide screenshots of ingame and or explorer?
1 Like
Did you set the Adornee to the correct part?
1 Like
Alright, maybe like luaNerd said, Make sure the Adornee is only on the door. Also can you share the code, the problem may be happening there.
I had the Adornee set to the door.
1 Like
Here’s my local script under the billboardgui under the screengui:
local Player = game.Players.LocalPlayer
local UIS = game:GetService("UserInputService")
local DoorOpener = game:GetService("ReplicatedStorage").DoorOpener
UIS.InputBegan:Connect(function(Input,Istyping)
if Istyping then
return
elseif Input.KeyCode == Enum.KeyCode.E then
DoorOpener:FireServer()
end
end)
local Insight = false
while wait() do
if Insight == false then
Insight = true
local ButtonClone = script.Parent:Clone()
ButtonClone.Parent = workspace.CurrentCamera
ButtonClone.Adornee = workspace.Door
ButtonClone.TextLabel.Visible = true
end
end
if Insight then
if workspace.CurrentCamera:FindFirstChild("Button") then
workspace.CurrentCamera.Button:remove()
end
end
and the server script in the serverscriptservice:
local Tween = game:GetService("TweenService")
local Door = workspace.Door
local DoorHinge = Door.PrimaryPart
local DoorOpener = game:GetService("ReplicatedStorage").DoorOpener
local Info = TweenInfo.new()
local opened = false
DoorOpener.OnServerEvent:Connect(function()
local degree = 90
if opened then
degree = -90
opened = false
else
opened = true
end
local TweenCreate = Tween:Create(DoorHinge,Info,{CFrame = DoorHinge.CFrame * CFrame.Angles(0,math.rad(degree),0)})
wait(0.5)
TweenCreate:Play()
end)
In your code, when it said ButtonClone.Parent = workspace.CurrentCamera, I’m pretty sure you want that to be in the PlayerGui
1 Like
So I changed it to this:
local Player = game.Players.LocalPlayer
local PlayerGui = Player.PlayerGui
local UIS = game:GetService("UserInputService")
local DoorOpener = game:GetService("ReplicatedStorage").DoorOpener
UIS.InputBegan:Connect(function(Input,Istyping)
if Istyping then
return
elseif Input.KeyCode == Enum.KeyCode.E then
DoorOpener:FireServer()
end
end)
local Insight = false
while wait() do
if Insight == false then
Insight = true
local ButtonClone = script.Parent:Clone()
ButtonClone.Parent = Player.PlayerGui
ButtonClone.Adornee = workspace.Door
ButtonClone.TextLabel.Visible = true
end
end
if Insight then
if workspace.CurrentCamera:FindFirstChild("Button") then
workspace.CurrentCamera.Button:remove()
end
end
And it’s still not working.