I tried searching up how to do it, and still, it won't work. Here is my code.
function leftClick()
game.ServerStorage.freecards:Clone().Parent = workspace
end
I tried searching up how to do it, and still, it won't work. Here is my code.
function leftClick()
game.ServerStorage.freecards:Clone().Parent = workspace
end
You’re having the same issue like last time. You made the function but you’re not calling the function. It should also be in a regular script.
local ss = game:GetService("ServerStorage") --this makes serverstorage a variable that you could easily use.
local freecards = ss:WaitForChild("freecards") --this creates an easy reference to the object you’re cloning
function leftClick()
local freecardsclone = freecards:Clone() --clones the object
freecardsclone.Parent = game.Workspace --moves the object to workspace
end
--Now we have to call the function
script.Parent.MouseButton1Click:connect(leftClick) -- Waits until the button is clicked
I haven’t tested this yet but I hope it works.
UPDATED ANSWER
You need to use Events. These can transport info between the server and the client. You need to make two scripts. One that will make the event fire, and one that spawns the thing when the event is received. You can read how to do this here: https://developer.roblox.com/ko-kr/articles/Remote-Functions-and-Events
I hope this helps you!
Best,
TheLastHabanero
it says " 10:49:17.787 - freecards is not a valid member of ServerStorage" but I put freecards into ServerStorage
nvm I used a localscript, when I changed it to a script it would not do anything and no errors.
Ok I know what's wrong. Do game.ServerStorage:FindFirstChild("freecards"):Clone(workspace)
same thing, not working with no error. I will try putting it somewhere else.
Ok. I forgot about one thing. ServerEvents!
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
It gave an error "11:22:02.272 - Players.SadWowow21.PlayerGui.ScreenGui.admin.freecard.Script:1: Unexpected Unicode character: U+201c. Did you mean '"'?"
This is because of the quotations. They needs to be " (upright), this is auto-generated by the Studio. On a different device, such as mobile, this isn’t when using StackEdit. This resulted in “ instead of ". “ can’t be understood by the compiler
Sorry about that, I was on mobile. Just replace the the quotation marks with your own.