hi all
I have a problem. I have a server script with a tweenservice now it is supposed to sized up but on the client it sized to the middle and on the server it does it right anyone any idea is this a bug or am I doing something wrong
Server
-- ServerScriptService
local TweenService = game:GetService("TweenService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local resizePart = game.Workspace["Volvo FL TS 2[02-6131]"].Body.Model.Luiken.LuikDL1.Closed
local isOpen = false
local openSize = Vector3.new(resizePart.Size.X, 0.325, resizePart.Size.Z)
local closedSize = Vector3.new(resizePart.Size.X, 5.125, resizePart.Size.Z)
local function toggleLuik()
local targetSize
local targetPosi
if isOpen then
targetSize = closedSize
local rootPoint = resizePart.Position - Vector3.new(0, resizePart.Size.Y/2, 0)
targetPosi = rootPoint - Vector3.new(0, closedSize.Y/2, 0)
else
targetSize = openSize
local rootPoint = resizePart.Position + Vector3.new(0, resizePart.Size.Y/2, 0)
targetPosi = rootPoint + Vector3.new(0, openSize.Y/2, 0)
end
local resizeTweenInfo = TweenInfo.new(5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local tweenData = {
Size = targetSize,
Position = targetPosi
}
TweenService:Create(resizePart, resizeTweenInfo, tweenData):Play()
-- Toggle de status van het luik
isOpen = not isOpen
end
-- Luister naar het RemoteEvent van de client om het luik te openen/sluiten
ReplicatedStorage.ToggleLuikEvent.OnServerEvent:Connect(function(player)
toggleLuik()
end)
Client
-- LocalScript (Client)
local TweenService = game:GetService("TweenService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local resizePart = script.Parent.Parent.Closed
local isOpen = false
local function toggleLuik()
-- Fire het RemoteEvent om de server te vertellen dat het luik is geklikt
ReplicatedStorage.ToggleLuikEvent:FireServer()
end
local clickDetector = script.Parent.Parent.Open:FindFirstChildOfClass("ClickDetector")
if clickDetector then
clickDetector.MouseClick:Connect(toggleLuik)
else
print("ClickDetector niet gevonden op het luik.")
end