I tested place with my friend and when i triggered proximity prompt actions ran on all clients.
I was thinkinng a lot how to fix it and i guess i need help with this issue
Here is the script:
local Cam = workspace.CurrentCamera
local Player = game:GetService("Players").LocalPlayer
local Chr = game.Workspace:WaitForChild(Player.Name)
local Character = Player.Character
local Humanoid = Chr:WaitForChild("Humanoid")
local PS = workspace:WaitForChild("Partcam").ProximityPrompt
local BBGUI = PS.Parent.BillboardGui
local RS = game:GetService("RunService")
local Clicksound = game.Workspace.Partcam.ProximityPrompt.Sound
local Team = game.Teams.Table1
local TS = game:GetService("TweenService")
PS.PromptShown:Connect(function()
BBGUI.Enabled = true
end)
PS.PromptHidden:Connect(function()
BBGUI.Enabled = false
end)
PS.Parent.ClickDetector.MouseClick:Connect(function(click)
if game.Players:GetPlayerFromCharacter(click.Parent) then
if click.Parent.Name == Player.Name then
Clicksound:Play()
Character:MoveTo(workspace.ad.Position)
Player.Team = Team
Humanoid.CameraOffset = Vector3.new(0, 0, 0)
for i, part in pairs(Character:GetChildren()) do
if part:IsA("BasePart") then
part.LocalTransparencyModifier = 0
if string.match(part.Name, "Head") then
part.LocalTransparencyModifier = 1
end
end
end
Cam.CameraType = Enum.CameraType.Scriptable
Humanoid.WalkSpeed = 0
wait(2)
Cam.CFrame = Cam.CFrame * CFrame.Angles(math.deg(0), math.deg(0), math.deg(0))
Cam.CFrame = workspace["Test Cam"].CFrame
wait(2)
workspace.Table1Blur1.BillboardGui.BlurEffect.Transparency = 1
local goal = {}
goal.Transparency = 0.5
local tweenInfo = TweenInfo.new(5)
local Tween = TS:Create(workspace.Table1Blur1.BillboardGui.BlurEffect, tweenInfo, goal)
Tween:Play()
wait(1)
workspace:WaitForChild("Cafe Ambient part").Music1.CompressorSoundEffect.Enabled = true
end
end
end)
PS.Triggered:Connect(function(trig)
if game.Players:GetPlayerFromCharacter(trig.Parent) then
if trig.Parent.Name == Player.Name then
Clicksound:Play()
Character:MoveTo(workspace.ad.Position)
Player.Team = Team
Humanoid.CameraOffset = Vector3.new(0, 0, 0)
for i, part in pairs(Character:GetChildren()) do
if part:IsA("BasePart") then
part.LocalTransparencyModifier = 0
if string.match(part.Name, "Head") then
part.LocalTransparencyModifier = 1
end
end
end
Cam.CameraType = Enum.CameraType.Scriptable
Humanoid.WalkSpeed = 0
wait(2)
Cam.CFrame = Cam.CFrame * CFrame.Angles(math.deg(0), math.deg(0), math.deg(0))
Cam.CFrame = workspace["Test Cam"].CFrame
wait(2)
workspace.Table1Blur1.BillboardGui.BlurEffect.Transparency = 1
local goal = {}
goal.Transparency = 0.5
local tweenInfo = TweenInfo.new(5)
local Tween = TS:Create(workspace.Table1Blur1.BillboardGui.BlurEffect, tweenInfo, goal)
Tween:Play()
wait(1)
workspace:WaitForChild("Cafe Ambient part").Music1.CompressorSoundEffect.Enabled = true
end
end
end)
Script is local and it locates in starterplayerscripts
I tried to make remote events but there was no way to do that or i’m mistaking and there is a way to fix the problem that way