Im animation dont want play im dont know why any error
Make sure youâre playing your animation by doing :Play()
on the tween animation.
Okay, I canât even see you fire the remoteFunction. I suspect you are using player instead of character in its parameter.
Also do this in the future
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
Fire:Player() Makes no sense at all if thatâs what he did , wait for player to be added, add a delay
He shouldâve done something like
if character then
local door = remoteFunction:InvokeServer(player, character)
end
--server
local function doorScript(player, character)
--code
end
remoteFunction.OnServerInvoke = doorScript
1 Like
Had some time to spare, and I made a quick script for this.
--Local
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local Door = workspace.Part
local RS = game:GetService("ReplicatedStorage")
local remoteEvent = RS.RemoteEvent
local function door()
local distance = (character.HumanoidRootPart.Position - Door.Position).Magnitude
if distance <= 5 then
remoteEvent:FireServer()
end
end
game:GetService("ContextActionService"):BindAction("OpenDoor", door, false, Enum.KeyCode.E)
--Server
local Door = workspace.Part
local RS = game:GetService("ReplicatedStorage")
local remoteEvent = RS.RemoteEvent
local tweenService = game:GetService("TweenService")
local tweenInformation = TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
local tweenProperties = {
Position = Vector3.new(10,10,10) -- tweak this to fit your needs
}
remoteEvent.OnServerEvent:Connect(function(player)
local tween = tweenService:Create(Door, tweenInformation, tweenProperties)
tween:Play()
end)
1 Like