Greetings, basically the system should work as shown in the clip. But I have an issue. When I touch the sword part everything works just perfect, but now as another Player touches the swordpart it disappears for my client. Although anyone who is currently touching the sword part should be having the UI open. The UI should not close as any other Players step on. Keep in mind this is all in a Local Script.
Video footage taken by one of the other Developers:
local AllSwords = script.Parent.AllSwords
local Frame1 = AllSwords.Frame1
local Frame2 = AllSwords.Frame2
local Frame3 = AllSwords.Frame3
local CurrentSword = script.Parent.CurrentSwordUI
local Back = AllSwords.Back
local Next = AllSwords.Next
local swordpart = game.Workspace.swordpart
local val = false
local cooldown = false
local cam = game.Workspace.Camera
local CamPart = game.Workspace.ShopCam
local Lighting = game.Lighting
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SwordCheck = ReplicatedStorage:WaitForChild("SwordCheck")
local TweenService = game:GetService("TweenService")
swordpart.Touched:Connect(function(Object)
local Plr = game.Players.LocalPlayer
if Object.Parent:FindFirstChild("Humanoid") then
if game.Players:GetPlayerFromCharacter(Object.Parent) == Plr then
if val == false and cooldown == false then
val = true
local WaitTime = 0.1
local tweeninfo = TweenInfo.new(
1,
Enum.EasingStyle.Sine,
Enum.EasingDirection.In,
0,
false,
0)
local function DoFrame(Color)
if not game.Players.LocalPlayer.PlayerGui:FindFirstChild("TweenUI") then
local UI = Instance.new("ScreenGui")
UI.Name = "TweenUI"
UI.Parent = game.Players.LocalPlayer.PlayerGui
end
local Frame = Instance.new("Frame")
Frame.Size = UDim2.new(1,0,1.1,0)
Frame.BorderSizePixel = 0
Frame.Position = UDim2.new(0,0,1.1,0)
Frame.BackgroundColor3 = Color
Frame.ZIndex = 5
Frame.Parent = game.Players.LocalPlayer.PlayerGui:WaitForChild("TweenUI")
TweenService:Create(Frame, tweeninfo, {Position = UDim2.new(0,0,-0.1,0)}):Play()
wait(WaitTime*2)
TweenService:Create(Frame, tweeninfo, {Position = UDim2.new(0,0,-1.2,0)}):Play()
end
DoFrame(Color3.new(0.111711, 0.111711, 0.111711))
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
wait(WaitTime)
game.Players.LocalPlayer.PlayerGui.SettingsUI.Enabled = false
if game.Players.LocalPlayer.PlayerGui:FindFirstChild("ModUI") then
game.Players.LocalPlayer.PlayerGui:WaitForChild("ModUI").Enabled = false
end
DoFrame(Color3.new(0.162936, 0.163622, 0.165698))
wait(WaitTime)
DoFrame(Color3.new(0.245075, 0.246113, 0.249226))
cam.CameraType = "Scriptable"
Lighting.DepthOfField.FarIntensity = 0.3
Lighting.DepthOfField.InFocusRadius = 8
cam.CFrame = CamPart.CFrame
wait((WaitTime*3+1)-0.5)
script.Parent.Enabled = true
wait(0.5)
game.Players.LocalPlayer.PlayerGui.TweenUI:Destroy()
end
end
end
end)
As you see in the clip I walked into the Area (white guy on the right) and my friend lost the UI on his screen. That should not happen. The UI should only be closing when the Player clicks on the red X button.
It’s a snippet of the entire script. The X button works on there. Right now the issue is that the UI disappears from clients as another Player touches the swordpart.
local Player = game:GetService("Players").LocalPlayer
swordpart.Touched:Connect(function(Part)
local FakePlayer = game:GetService("Players"):GetPlayerFromCharacter(Part.Parent)
if FakePlayer ~= nil and tostring(FakePlayer):lower():match(tostring(Player):lower()) then
--
end
end)
I applied that to the snipped but unfortunately the UI still gets removed from the other Player that touched the swordpart first as the second Player entered the swordpart.
Maybe it would be helpful seeing this snipped (detects when a Player walks out of the area and removes the UI) as well:
swordpart.TouchEnded:Connect(function()
if script.Parent.Enabled == true then
local debounce = false
if debounce == false then
debounce = true
cooldown = true
local WaitTime = 0.1
local tweeninfo = TweenInfo.new(
1,
Enum.EasingStyle.Sine,
Enum.EasingDirection.In,
0,
false,
0 )
local function DoFrame(Color)
if not game.Players.LocalPlayer.PlayerGui:FindFirstChild("TweenUI") then
local UI = Instance.new("ScreenGui")
UI.Name = "TweenUI"
UI.Parent = game.Players.LocalPlayer.PlayerGui
end
local Frame = Instance.new("Frame")
Frame.Size = UDim2.new(1,0,1.1,0)
Frame.BorderSizePixel = 0
Frame.Position = UDim2.new(0,0,1.1,0)
Frame.BackgroundColor3 = Color
Frame.ZIndex = 5
Frame.Parent = game.Players.LocalPlayer.PlayerGui:WaitForChild("TweenUI")
TweenService:Create(Frame, tweeninfo, {Position = UDim2.new(0,0,-0.1,0)}):Play()
wait(WaitTime*2)
TweenService:Create(Frame, tweeninfo, {Position = UDim2.new(0,0,-1.2,0)}):Play()
end
DoFrame(Color3.new(0.111711, 0.111711, 0.111711))
wait(WaitTime)
DoFrame(Color3.new(0.162936, 0.163622, 0.165698))
wait(WaitTime)
DoFrame(Color3.new(0.245075, 0.246113, 0.249226))
cam.CameraType = "Custom"
Lighting.DepthOfField.FarIntensity = 0.186
Lighting.DepthOfField.InFocusRadius = 50
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, true)
script.Parent.Enabled = false
if game.Players.LocalPlayer.PlayerGui:FindFirstChild("ModUI") then
game.Players.LocalPlayer.PlayerGui:WaitForChild("ModUI").Enabled = true
end
wait((WaitTime*3+1)-0.5)
game.Players.LocalPlayer.PlayerGui.SettingsUI.Enabled = true
wait(0.5)
if game.Players.LocalPlayer.PlayerGui:FindFirstChild("TweenUI") then
game.Players.LocalPlayer.PlayerGui.TweenUI:Destroy()
end
debounce = false
val = false
wait(2)
cooldown = false
end
end
end)