-
What do you want to achieve?
When a command is said in chat, I would like an obby to appear at set location in the game. -
What is the issue?
I have no idea how to script and this is a big road block for the game I’m making. Im making it solo. -
What solutions have you tried so far?
I have tried looking for youtube videos but none of them help, I have searched through Devforum and found nothing…
If there are any topics open that’ll are very similar to this, I would like to know them1
First define the Primary Part of your obbie’s model (this will be the center part)
Then move it somewhere that isn’t the workspace (I recommend you use ReplicatedStorage)
Now create a remote event inside replicated storage and rename it to ObbyEvent
Then create a LocalScript inside StarterPlayerScripts with this inside
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
LocalPlayer.Chatted:Connect(function(Message)
if Message == "!spawn obby" then --Change "!spawn obby" by whatever you want, it will define the command
game.ReplicatedStorage.ObbyEvent:FireServer()
end
end)
And a script inside ServerScriptService with this inside
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ObbyEvent = ReplicatedStorage.ObbyEvent
local Obby = game.ReplicatedStorage.Obby.Obby1 --Change this to your obby/obbie's folder
local Orientation = Vector3.new(0, 0, 90) --Change this to your obby's orientation
local Position = Vector3.new(-26, 0.5, -76) --Change this to your obby's position
ObbyEvent.OnServerEvent:Connect(function()
Obby:Clone().Parent = game.Workspace
Obby:SetPrimaryPartCFrame(CFrame.new(Position) * CFrame.Angles(Orientation))
end)
You can use the player.Chatted event to check what the player said and then parent the obby from ServerStorage to workspace:
local Chat = game:GetService("Chat")
function OnPlayerAdded(player)
-- Add Chatted Connect Even t
player.Chatted:Connect(function(Message)
-- Check Chat Message
-- clone obby from storage to workspace
end)
end
Players.PlayerAdded:Connect(OnPlayerAdded)
Ok! So I tried this and it worked. Thank you VERY MUCH.
But, what would I do if I want to remove it?
Adding on, for only a certain group rank to do it.
Sorry if I’m asking for a lot, I have no Idea how to script and all and Devforum is my only resort