-
What do you want to achieve?
Basically i want that when a player touch the cap of this bottle the cap goes at the top of the Eiffel Tower. But i want that the player is on the cap.
I tried using tweenservice, but only the part move and not the player
I tried to search for some script and a friend of mine recommended this script to me. First when somone touch a part then i fireallclients and then i do the “movement”.
The problem is that it doesn’t work… No errors in output
— SERVERSCRIPT (ON THE PLUG)—
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
game.ReplicatedStorage.TopEvent:FireAllClients(hit)
end
end)
And the localscript in startercharacterscript
wait(3)
local plr = game.Players.LocalPlayer
local LastTrainCFrame
local Function
local Function2
Function = game.ReplicatedStorage.TopEvent.OnClientEvent:Connect(function(hit)
local RootPart = hit.Parent.LowerTorso
local Ignore = hit.Parent
local ray = Ray.new(RootPart.CFrame.p,Vector3.new(0,-50,0))
local Hit, Position, Normal, Material = workspace:FindPartOnRay(ray,Ignore)
if not Hit then
elseif Hit and Hit.Name == "Top" then
local Train = Hit
if LastTrainCFrame == nil then
LastTrainCFrame = Train.CFrame
end
local TrainCF = Train.CFrame
local Rel = TrainCF * LastTrainCFrame:inverse()
LastTrainCFrame = Train.CFrame
RootPart.CFrame = Rel * RootPart.CFrame
else
LastTrainCFrame = nil
end
Function2 = hit.Parent.Humanoid.Died:Connect(function()
Function:Disconnect()
Function2:Disconnect()
end)
end)
TYSM for answers : D