Hey developers,
I encounter some problem that I don’t know why .I have a script that supposed to tween the door but something went wrong .The door didn’t tween at all but the output is printing very well. I cant find any solution for my problem .It will be a great help if you can help me .This is my script:
local tweenService = game:GetService("TweenService")
local ti = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,-1,true,0)
local player = game:GetService("Players").LocalPlayer
local function StartTween(part)
local hinge = part
local goal = {}
goal.CFrame = hinge.CFrame * CFrame.Angles(0,math.rad(-90),0)
local ended = {}
goal.CFrame = hinge.CFrame * CFrame.Angles(0,0,0)
local startingtween = tweenService:Create(hinge,ti,goal)
local endedtween = tweenService:Create(hinge,ti,ended)
startingtween:Play()
endedtween:Play()
end
game.ReplicatedStorage.RemoteEvent.OpenDoorEvent.OpenDoorBar.OnServerEvent:Connect(function(player, hinge)
StartTween(hinge)
print("fired")
end)
Is this from a LocalScript or a ServerScript?
its server script…(((()))))
In line 3 of your script, you did:
local player = game:GetService("Players").LocalPlayer
You can only do this in a LocalScript. If you are using a ServerScript, you cannot use LocalPlayer.
This may result in a script error. Let me know if this helps.
Its still same , but last time it did work .Idk why
Can I see what error it displays in your output?
I have local script that supposed to run this.do you want to see it??
wait.I take a screen shot first
There appears to be nothing in the ended table and the goal is being overridden with a CFrame that I don’t think will even move the door.
also this is the script that supposed to fire the event:
local player = game.Players.LocalPlayer
local bill = script.Parent.BillboardGui
local but = bill.TextButton
local doorparent = game.Workspace.Door
local UseInputService = game:GetService("UserInputService")
UseInputService.InputBegan:Connect(function(input, gameproces)
for i , v in pairs(doorparent:GetChildren())do
if (player.Character.HumanoidRootPart.Position - v.Door.Position).Magnitude < 15 then
bill.Adornee = v
print("nearby passenger")
if gameproces then return end
print("running rn")
if not gameproces then
print("about to runn")
if input.KeyCode == Enum.KeyCode.E then
if bill.Adornee == v then
print(v)
bill.TextButton:TweenSize(
UDim2.fromOffset(55, 55),
Enum.EasingDirection.Out,
Enum.EasingStyle.Linear,
1,
false,
nil
)
wait(.5)
print("buur")
game.ReplicatedStorage.RemoteEvent.OpenDoorEvent.OpenDoorBar:FireServer(v.Hinge)
bill.TextButton:TweenSize(
UDim2.fromOffset(50,50),
Enum.EasingDirection.In,
Enum.EasingStyle.Linear,
1,
false,
nil
)
print("done")
end
end
end
end
end
end)