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

[Solved] My local script isn't finding ServerStorage?

Asked by 8 years ago

I have a LocalScript that's inside a GUI. I'm having a problem were it looks like that my local script isn't finding the ServerStorage in online mode. It works in solo mode. I know this because i used print in online mode and the log didn't printed "Found ServerStorage". Any help?

local player = game.Players.LocalPlayer

local frame = script.Parent.Parent.Parent:WaitForChild("Frame2")
print("Found frame2")
local mouseoff = true
local ss = game:WaitForChild("ServerStorage")
print("Found ServerStorage")
local g = ss:WaitForChild("Gears")
print("Found Gears")
local items = g:WaitForChild("Items")
print("Found Items")
local mouse = player:GetMouse()

function MoveFrame()
    while not mouseoff do
        wait(0)
        frame.Position = UDim2.new(0,mouse.X-180,0,mouse.Y-240)
        if mouseoff then
            break
        end
    end
end

script.Parent.MouseEnter:connect(function(x,y)
    print("Fired")
    if script.Parent.Item.Value ~= "" then
        print(script.Parent.Item.Value)
        local item = items:findFirstChild(script.Parent.Item.Value)
        frame.Position = UDim2.new(0,x-180,0,y-240)
        frame.ToolName.Text = item:findFirstChild("Name").Value
        frame.Category.Text = "Category: "..item.Category.Value
        if item:findFirstChild("Damage") then
            frame.Line1.Text = "Damage:" ..item.Damage.Value
            if item:findFirstChild("Special") then
                frame.Line2.Text = "Special:" ..item.Special.Value
            end
        elseif item:findFirstChild("Ability") then
            frame.Line1.Text = "Ability:" ..item.Ability.Value
        end
        frame.Visible = true
        mouseoff = false
        MoveFrame()
    end
end)

script.Parent.MouseLeave:connect(function()
    mouseoff = true 
    frame.Visible = false
    frame.Line1.Text = ""
    frame.Line2.Text = ""
end)

script.Parent.Item.Changed:connect(function()
    if script.Parent.Item.Value == "" then
        mouseoff = true 
        frame.Visible = false
        frame.Line1.Text = ""
        frame.Line2.Text = ""
    end
end)

Solution: LocalScripts can't access ServerStorage

0
Local scripts can't access server storage. docrobloxman52 407 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

since local scripts can't access server storage, you should put it in ReplicatedStorage.

Ad

Answer this question