I am trying to make a game on Roblox where you have a tool (key) and when they tool touches the keyhole on a door it is supposed to fling the door open, but that is not happening.
Here is the script inside the tool:
script.Parent.Tip.Touched:Connect(function(keyhole) --Tip is a part at the top of my tool
if keyhole.Name == "KeyHole1" then
game.ReplicatedStorage.KeyHole1Open.Value = true
end
end)
And here is the script inside the door:
while game.ReplicatedStorage.KeyHole1Open == true do
local TweenService = game:GetService("TweenService")
local Panel = workspace.Door
local PanelRoot = Panel.PrimaryPart
local PanelSwingInfo = TweenInfo.new() -- Let's use all defaults here
local PanelSwingTween = TweenService:Create(PanelRoot, PanelSwingInfo, {
CFrame = PanelRoot.CFrame * CFrame.Angles(0, math.rad(180), 0)
})
PanelSwingTween:Play()
end
NOTE: I am new to scripting on Roblox so that is why it doesn't work.
I would really appreciate if someone helped me out here.

3 comments
Oh you forgot to put .Value just after KeyHoleOpen on the first line of code on your door, thats a mistake i do even nowadays lol
You can see where the code gets an error on output window, to know what is and in which line is the error.
There was no error.