OH I FORGOT! You can’t use local scripts from workspace
seems to work just fine so long as you put the local script somewhere where localscripts can work, and then re-define the prompt (obviously)
Would ReplicatedStorage work? I don’t really know.
I tried to put it in ReplicatedStorage and ServerScriptService, but still doesnt even print
LocalScripts don’t work in either of those, I would recommend StarterGUI, or StarterPack because I know that both of those work
I put it in startergui and it worked, but it says this:
did you remember to re-difine the frame?
In changepainting?
local DSS = game:GetService("DataStoreService")
local DS = DSS:GetDataStore("DecalData")
local Players = game:GetService("Players")
local FrameFolder = workspace.Frames
local Decals = {
FrameFolder.FrameSM1,
}
local Plates = {
FrameFolder.FrameSM1.MetalFrame,
}
while wait(1) do
for i in pairs(Decals) do
local data = DS:GetAsync(i)
if data then
local Plates = Plates[i]
local decal = Decals[i]
local ImgId = data[1]
local Player = data[2]
local PlayerName = Players:GetNameFromUserIdAsync(Player)
Plates.Header.Donated.SurfaceGui.SIGN.Text = "This painting has been donated by:"
Plates.Header.Giver.SurfaceGui.SIGN.Text = PlayerName
decal.Image.Facer.Texture = ImgId
end
end
end
no in the localscript when you’re sending the data
local Players = game:GetService("Players")
local plr = Players.LocalPlayer
game.Workspace.Frames.FrameSM1.MetalFrame.Buy.Triggered:Connect(function()
print(plr.UserId)
local sendData = {
1, -- change to be whatever number it coresponds to in the table in the "changepainting" script
143751304,
plr.UserId
}
game.ReplicatedStorage.RemoteEvent:FireServer(sendData)
end)
I’m pretty sure I did it correctly.
yeah you did, I don’t know what is causing this issue
heres the script that has the error:
local Event = game.ReplicatedStorage.RemoteEvent
local DSS = game:GetService("DataStoreService")
local DS = DSS:GetDataStore("DecalData")
-- have it fire this event when the player purchases it
-- have the "data" variable (or whatever you name it) be a table containing the UserId of the player who purchased it, the Decal being edited, and the Decal Id (Decal first, Decal Id second, Player UserId third)
-- also make sure in the script for purchasing that the Decals in the table are in the same order
Event.OnServerEvent:Connect(function(data)
print("caught")
local DecalNumber = data[1]
local DecalId = data[2]
local UserId = data[3]
local DataTable = { -- name this variable whatever you want
DecalId,
UserId
}
DS:SetAsync(DecalNumber, DataTable)
end)
have you figured out anything? I haven’t lol.
Try using a table in datasaving, you can save a lot with it.
I got it working, the problem is that the script keeps on loading it.
This is fairly simple enough, you can just save the asset ID of the decal & the userId of the player in 1 DataStore.
Thanks to you, I have the game functional and working! All I need to do is build the museum and the game is done! You’ll definitely get credit for scripting.