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

Module Script keeps crashing? Thanks for the help.

Asked by 10 years ago

Module Script (In workspace)

local DataSave = {}
--wait()
--game:WaitForChild("ServerStorage")
----game:WaitForChild("DataStoreService")
game:GetService("DataStoreService")
local SafeStore = game.ServerStorage:FindFirstChild("PlayersData")
local mouse = game.Players.LocalPlayer:GetMouse()

DataSave.ItemTaken = function()
    print(game.Players.LocalPlayer.Name)
    --local mouse = game.Players.LocalPlayer:GetMouse()
    local Player = game.Players.LocalPlayer
    --local PlrData = SafeStore:findFirstChild(Player.userId)
    if mouse.Target ~= nil then
        if mouse.Target:findFirstChild("CanPickUp") then
            if mouse.Target:findFirstChild("CanPickUp").Value == true then
                local Item = mouse.Target:findFirstChild("CanPickUp").Parent
                print(Item.Name .. " Is what your trying to pick up!")
                local found = nil
                local values = Player.Data.SlotHold:GetChildren()
                for i=1,#values do
                    if values[i].ClassName == "BoolValue" then
                        if values[i].Value == false then
                            found = values[i]
                            break
                        end
                    end
                end
                if found ~= nil then
                print(found)
                Player.Data.SlotHold:findFirstChild(found.Name).Value = true
                local CurrentSlot = Player.Data.SlotHold:findFirstChild(found.Slot.Value).Name
                print(Player.Data.SlotHold:findFirstChild(found.Slot.Value).Name .. " Is line 31")
                print(CurrentSlot.Name)
                local SlotTemp = Player.Data.SlotHold:findFirstChild(CurrentSlot)
                print(SlotTemp.Parent)
                SlotTemp.ItemName.Value = (mouse.Target:findFirstChild("CanPickUp").Parent.Name)
                ---CurrentSlot.ItemStock.Value = 
                end
                if found == nil then
                print("Invintory Full!")
                end
            end
        end
    end
end

return DataSave

Error

ServerStorage is not a caild member of DataModel
Script 'Workspace.DataSaveModule', Line 6
0
Also for no reason my rep was trashed.. So please don't ignore just cause I don't have some insane Rep.. harvest109 0 — 10y
0
Also might I add, It works fine in Studio Play Solo/Studio "Server" harvest109 0 — 10y

Answer this question