So I have this script(4x) that changes your cursor then makes a door openable which was originally locked. I was wondering if there was anything I could do to make it a bit smaller.
This is the first part which activates the cursor that changes the cursor and then unlocks the door
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local mouse = player:GetMouse()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local EnableDoor = ReplicatedStorage.RemoteEvents.EnableDoor
mouse.Button1Down:Connect(function()
if mouse.Target:FindFirstChild("Activator") then
script.Parent.AwakenEye.Disabled = false
EnableDoor:FireServer()
end
end)
This is the script that changes the cursor
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local mouse = player:GetMouse()
local ClickIcon = "http://www.roblox.com/asset/?id=8511107098" --Icon that shows when hovering over ClickDetector
local MouseIcon = "http://www.roblox.com/asset/?id=8511106147" --Icon that shows when not hovering over ClickDetector
mouse.Move:Connect(function()
if mouse.Target and mouse.Target:FindFirstChild("EyeDetector") then
mouse.Icon = ClickIcon
else mouse.Icon = MouseIcon
end
end)
This script enables the door and sets it to the right settings
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local mouse = player:GetMouse()
local ClickIcon = "http://www.roblox.com/asset/?id=8511107098" --Icon that shows when hovering over ClickDetector
local MouseIcon = "http://www.roblox.com/asset/?id=8511106147" --Icon that shows when not hovering over ClickDetector
mouse.Move:Connect(function()
if mouse.Target and mouse.Target:FindFirstChild("EyeDetector") then
mouse.Icon = ClickIcon
else mouse.Icon = MouseIcon
end
end)