basically, i have a proximity prompt inside of model in workspace, but the problem is, the code is in a local script and it has to be as it has code for tweening the camera. im aware that local scripts cant be in workspace, so what should i do? here is the code:
LOCAL SCRIPT:
local Prox = script.Parent
local Player = game:GetService("Players")
local FuseEvent = game:GetService("ReplicatedStorage"):WaitForChild("FuseFixed")
local Camera = workspace.CurrentCamera
local TweenService = game:GetService("TweenService")
local Char = Player.LocalPlayer.Character or Player.LocalPlayer.CharacterAdded:Wait()
local FixAnim = Char.Humanoid.Animator:LoadAnimation(script:WaitForChild("Animation"))
local CameraFixing = TweenInfo.new(.4, -- Time
Enum.EasingStyle.Quad, -- EasingStyle
Enum.EasingDirection.InOut, -- EasingDirection
0, -- RepeatCount (when less than zero the tween will loop indefinitely)
false, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime) -- Let's use all defaults here
)
local CameraFix1 = TweenService:Create(Camera, CameraFixing, {
CFrame = Prox.Parent.Parent.ProxCam1.CFrame
})
local CameraFixing2 = TweenInfo.new(4, -- Time
Enum.EasingStyle.Quad, -- EasingStyle
Enum.EasingDirection.InOut, -- EasingDirection
-1, -- RepeatCount (when less than zero the tween will loop indefinitely)
true, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime) -- Let's use all defaults here
)
local CameraFix2 = TweenService:Create(Camera, CameraFixing, {
CFrame = Prox.Parent.Parent.ProxCam2.CFrame
})
local function ResetCam()
task.wait()
Camera.CameraType = Enum.CameraType.Custom
task.wait()
Camera.CameraSubject = Char.Humanoid
end
Prox.PromptButtonHoldBegan:Connect(function()
task.wait()
Camera.CameraType = Enum.CameraType.Scriptable
task.wait()
FixAnim:Play()
CameraFix1:Play()
CameraFix1.Completed:Connect(function()
CameraFix2:Play()
end)
end)
Prox.PromptButtonHoldEnded:Connect(function()
ResetCam()
FixAnim:Stop()
CameraFix1:Cancel()
CameraFix2:Cancel()
end)
Prox.Triggered:Connect(function()
ResetCam()
print("Fuse Fixed")
CameraFix1:Cancel()
CameraFix2:Cancel()
FixAnim:Stop()
FuseEvent:FireServer()
end)
SERVER SCRIPT (for remote event):
local FuseEvent = game:GetService("ReplicatedStorage"):WaitForChild("FuseFixed")
FuseEvent.OnServerEvent:Connect(function()
local TweenService = game:GetService("TweenService")
local FuseGUI = game:GetService("StarterGui"):WaitForChild("FuseFixed")
local Text = FuseGUI.TextLabel
FuseGUI.Enabled = true
FuseGUI.TextLabel.Visible = true
FuseGUI.TextLabel.Frame.Visible = true
local FuseTween = TweenInfo.new(4, -- Time
Enum.EasingStyle.Bounce, -- EasingStyle
Enum.EasingDirection.In, -- EasingDirection
0, -- RepeatCount (when less than zero the tween will loop indefinitely)
false, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime) -- Let's use all defaults here
)
local FuseText = TweenService:Create(
Text, FuseTween, {TextTransparency = 0})
local FuseTween = TweenInfo.new(4, -- Time
Enum.EasingStyle.Bounce, -- EasingStyle
Enum.EasingDirection.In, -- EasingDirection
0, -- RepeatCount (when less than zero the tween will loop indefinitely)
false, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime) -- Let's use all defaults here
)
local FuseText2 = TweenService:Create(
Text, FuseTween, {TextTransparency = 1})
print("FIXED")
FuseText:Play()
task.wait(3)
FuseText2:Play()
end)