Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

InsertService cannot be used to load assets from the client? (Mobile Buttons Issue)

Asked by 5 years ago

I'm trying to make mobile buttons on my game, but this error keeps coming up (InsertService cannot be used to load assets from the client?) I have no idea what this means. Help?

Here's both of my scripts:

--[[LOCAL SCRIPT]]--

ready = true

local function mobileopenButtonPress()
    game.ReplicatedStorage.RemoteEvents:WaitForChild("MobileClosetOPEN").OnClientEvent:Connect(function(player, tween1, tween2)
    if (game.Workspace.Closet.PrimaryPart.Position - player.Character.HumanoidRootPart.Position).magnitude <= 8 and ready == true then
        ready = false
        tween1:Play()
        tween2:Play()
        wait(.8)
        ready = true
    end
end)

game:GetService("ContextActionService"):BindAction("OpenDoorButton", mobileopenButtonPress, true, Enum.KeyCode.E)
    game:GetService("ContextActionService"):SetPosition("OpenDoorButton", UDim2.new(.72,-25,.2,-25))
    game:GetService("ContextActionService"):SetTitle("OpenDoorButton","OPEN")
end

local function mobilecloseButtonPress()
    game.ReplicatedStorage.RemoteEvents:WaitForChild("MobileClosetCLOSE").OnClientEvent:Connect(function(player, tween1, tween2)
        if (game.Workspace.DoorOfCloset.PrimaryPart.Position - player.Character.HumanoidRootPart.Position).magnitude <= 8 and ready == true then
            ready = false
            tween1:Play()
            tween2:Play()
            wait(.8)
            ready = true
                end
            end)
        game:GetService("ContextActionService"):BindAction("CloseDoorButton", mobilecloseButtonPress, true, Enum.KeyCode.E)
            game:GetService("ContextActionService"):SetPosition("CloseDoorButton", UDim2.new(.72,-25,.2,-25))
            game:GetService("ContextActionService"):SetTitle("CloseDoorButton","CLOSE")
    end
--[[SERVER SCRIPT]]--

wait()
local plr = game.Players.PlayerAdded:Connect(function(plr)

local TS = game:GetService("TweenService")
local tI = TweenInfo.new(1.25, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

game.Workspace:WaitForChild("Closet") 
game.Workspace:WaitForChild("DoorOfCloset")

local d1Open = {CFrame = CFrame.new(93.8, 7.75, -105.3)}
local d2Open = {CFrame = CFrame.new(104.1, 7.75, -105.3)}
local d1Close = {CFrame = CFrame.new(96.6, 7.75, -105.3)}
local d2Close = {CFrame = CFrame.new(101.5, 7.75, -105.3)}
local tween1o = TS:Create(game.Workspace.Closet.Door1,tI,d1Open)
local tween1c = TS:Create(game.Workspace.Closet.Door1,tI,d1Close)
local tween2o = TS:Create(game.Workspace.DoorOfCloset.Door2,tI,d2Open)
local tween2c = TS:Create(game.Workspace.DoorOfCloset.Door2,tI,d2Close)


game.ReplicatedStorage.RemoteEvents:WaitForChild("MobileClosetOPEN"):FireClient(plr, tween1o, tween2o)

game.ReplicatedStorage.RemoteEvents:WaitForChild("MobileClosetCLOSE"):FireClient(plr, tween1c, tween2c)
end)

Answer this question