in the game i’m working on, you collect ‘shards’ of certain shapes. i want there to be a person you talk to, you give them the shards (if you have the right amount) and then the door opens behind them, and they disappear. can anyone help me figure out how to script this? im still learning scripting!
What you will want to do is start by having a button that appears and when clicked fires an remote event
IM NOT SURE IF THIS WILL WORK IF IT DOESNT THIS IS A ROUGH LAYOUT OF WHAT YOU WANT YOU CAN FURTHER DEVELOP BY GIVEING THE PLAYER A WORLD FOLDER (SIMILAR TO LEADERSTATS) AND WHEN THE WORLD IS UNLOCKED THERE IS A UNIQUE REMOTE EVENT THAT GETS FIRED AND ON THE SERVER THE VALUE IS CHANGED TO TRUE AND HAVE A SEPERATE SCRIPT ON THE SERVER TO CHECK IF THE VALUE IS TRUE
(EXAMPLE SCRIPT)
if World.Value == true then FireAnEvent:FireClient()
AND THEN ON THE CLIENT DO(EXAMPLE SCRIPT)
FireAnEvent:OnServerEvent:connect(function() bigdoor = game.Workspace.Door bigdoor.Cancollide = false bigdoor.transparency = 1 end
CLIENT(MAIN SCRIPT)
script.Parent.MouseButton1Click:Connect(function() YourEventPathDirectoryHere:FireServer() end)
On the server you want to have(MAIN SCRIPT)
local function Door(plr) local playr = game.Players:FindFirstChild(plr.Name) local leaderstats = playr.leaderstats.shards if leaderstats.Value >= HowMuchYouRequireHere then AnotherEventDirectoryForADiffrentEvent:-- I dont know if its FireClient() or FireServer() end local SC = game.ReplicatedStorage.YourFolderHere:WaitForChild("YourEventNameHere") SC.OnServerEvent:Connect(Door)
CLIENT(MAINSCRIPT)
local function door local BigDoor = DoorDirectoryHere BigDoor.CanCollide = false BigDoor.Transparency = 1 end AnotherEventDirectoryForADiffrentEvent: -- I dont know if its OnServerEvent:Connect(door) or OnClientEvent:Connect(door)