I went to go test my game in the Test tab, and i come to find that a script that tweens parts doesn't work, and a script that tweens a GUI onto your screen doesn't work. Why? I've tried everything i know to try to fix it but nothing seems to work...
here is the script that tweens the GUI onto your screen.
script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
local gui = game.Players[hit.Parent.Name]:FindFirstChild("PlayerGui").ShopGui.CornerCafe
gui:TweenPosition(UDim2.new(.1, 0,0.2, 0),1,0,.3)
end
end)
script.Parent.TouchEnded:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
local gui = game.Players[hit.Parent.Name]:FindFirstChild("PlayerGui").ShopGui.CornerCafe
gui:TweenPosition(UDim2.new(-0.3, 0,0.2, 0),1,0,.3)
end
end)
Here is the script that tweens the 2 Parts
local TweenService = game:GetService("TweenService")
check = false
local sensor = script.Parent
local door1 = script.Parent.Parent.Floor_1.OutsideDoor.DoorLeft
local door2 = script.Parent.Parent.Floor_1.OutsideDoor.DoorRight
local tweeninformation = TweenInfo.new(
0.5,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0)
local door1open = {CFrame = CFrame.new(210.675, 6.175, -577.876)}
local door1close = {CFrame = CFrame.new(216.825, 6.175, -577.876)}
local door2open = {CFrame = CFrame.new(229.6, 6.175, -577.876)}
local door2close = {CFrame = CFrame.new(223.25, 6.175, -577.876)}
local tween1open = TweenService:Create(door1,tweeninformation,door1open)
local tween1close = TweenService:Create(door1,tweeninformation,door1close)
local tween2open = TweenService:Create(door2,tweeninformation,door2open)
local tween2close = TweenService:Create(door2,tweeninformation,door2close)
sensor.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
print"touched"
if check == false then
check = true
if game.Players[hit.Parent.Name].PlayerGui.NPCChat.NPC_Dialog.Visible == true then
local reason = "Chat ended because you walked away"
game:GetService("ServerScriptService").NoticeGUIEvent.Reason.Value = reason
game:GetService("ReplicatedStorage").RemoteEvents.NoticeGUI:FireServer(hit.Parent.Name)
end
game.Players[hit.Parent.Name].PlayerGui.NPCChat.NPC_Dialog.Visible = false
game.Players[hit.Parent.Name].PlayerGui.NPCChat.NPC_Dialog.Frame.Accept.Text = "Accept"
game.Players[hit.Parent.Name].PlayerGui.NPCChat.NPC_Dialog.Frame.Decline.Text = "Decline"
game.Players[hit.Parent.Name].PlayerGui.NPCChat.NPC_Dialog.Frame.Desc1.Text = " "
game.Players[hit.Parent.Name].PlayerGui.NPCChat.NPC_Dialog.Frame.NpcName.Text = "Name"
tween1open:Play()
tween2open:Play()
wait(2)
check = false
tween1close:Play()
tween2close:Play()
game:GetService("ServerScriptService").NoticeGUIEvent.Reason.Value = " "
end
end
end)
if anyone is able to help me and tell me why they aren't working it would mean a ton to me.

1 comment
I forgot to mention but the scripts work when i test it inside studio. Both scripts are a Server script. Both scripts are located inside of the Workspace.