Advertisement
mfx832

Untitled

Jan 12th, 2025
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.03 KB | None | 0 0
  1. --Server Side
  2. local Collection = game:GetService("CollectionService")
  3. local rep = game:GetService("ReplicatedStorage")
  4.  
  5.  
  6. for i,v in Collection:GetTagged("Interactive Models") do
  7.    
  8.     if v:GetAttribute("Text") then
  9.         local ClickDetector = Instance.new("ClickDetector")
  10.         ClickDetector.MaxActivationDistance = 9
  11.         ClickDetector.Parent = v
  12.         ClickDetector.MouseHoverEnter:Connect(function(player)
  13.                 rep.InteractiveRemote:FireClient(player, v, "Enter")
  14.         end)
  15.  
  16.         ClickDetector.MouseHoverLeave:Connect(function(player)
  17.             rep.InteractiveRemote:FireClient(player, v, "Leave")
  18.         end)
  19.     end
  20. end
  21.  
  22. --------------------------------------------------------------------------------------------------------
  23.  
  24. --Client Side
  25.  
  26. local rep = game:GetService("ReplicatedStorage")
  27. local gui = script.Parent.InteractiveGui
  28. local tween = game:GetService('TweenService')
  29.  
  30. local Dissapear = tween:Create(gui.Text, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextTransparency = 1})
  31. local Appear = tween:Create(gui.Text, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextTransparency = 0})
  32.  
  33. gui:WaitForChild("Text").TextTransparency = 1
  34.  
  35. rep.InteractiveRemote.OnClientEvent:Connect(function(v: Part, Status)
  36.     if Status == "Leave" then
  37.         if v:FindFirstChildWhichIsA("Highlight") then
  38.             local DissapearHighLight: Tween = tween:Create(v.Highlight, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {OutlineTransparency = 1})
  39.             DissapearHighLight:Play()
  40.             Dissapear:Play()
  41.             task.delay(1,function()
  42.                 v.Highlight:Destroy()
  43.             end)
  44.         end
  45.     elseif Status == "Enter" then
  46.        
  47.         local highlight = Instance.new("Highlight")
  48.         highlight.FillColor = Color3.fromRGB(255,255,255)
  49.         highlight.FillTransparency = 1
  50.         highlight.OutlineTransparency = 0.4
  51.         highlight.Parent = v
  52.         local DissapearHighLight = tween:Create(v.Highlight, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {OutlineTransparency = 0}):Play()
  53.  
  54.        
  55.         gui.Text.Text = v:GetAttribute("Text")
  56.         Appear:Play()
  57.     end
  58. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement