Hi I have a script here that when the player presses e, the door will open
local TweenService = game:GetService("TweenService")
local door = script.Parent.Door
local hinge = script.Parent.Hinge
local prompt = door.ProximityPrompt
local goalOpen = {}
goalOpen.CFrame = hinge.CFrame * CFrame.fromEulerAngles(0, 90, 0)
local goalClose = {}
goalClose.CFrame = hinge.CFrame * CFrame.Angles(0, 0, 0)
local tweenInfo = TweenInfo.new(2)
local tweenOpen = TweenService:Create(hinge, tweenInfo, goalOpen)
local tweenClose = TweenService:Create(hinge, tweenInfo, goalClose)
prompt.Triggered:Connect(function()
if prompt.ActionText == "Close" then
tweenClose:Play()
prompt.ActionText = "Open"
print("Closed")
else
tweenOpen:Play()
prompt.ActionText = "Close"
print("opened")
end
end)
I wnat to attempt to put this in a local script and make it so only the player can see their door on their screen open. How can I change this script to work like that?
If you use cframe it will still be replicated on the server, it doesn’t matter if you do it from the client, maybe you could try cloning the door from the client so that the door only exists on the client and not on the server, so would not replicate