To make your model named "fires" appear and disappear in a Roblox game using Lua code, you can use the following script:
```lua
local fires = game.Workspace:FindFirstChild("fires") -- Change "fires" to the name of your model
local function turnOnFires()
if fires then
fires.Parent = game.Workspace
end
end
local function turnOffFires()
if fires then
fires.Parent = nil
end
end
game.Players.PlayerAdded:Connect(function(player)
local playerInput = player:GetMouse()
playerInput.KeyDown:Connect(function(key)
if key == ":fireson" then
turnOnFires()
elseif key == ":firesoff" then
turnOffFires()
end
end)
end)
```
Make sure to replace "fires" in `local fires` with the actual name of your model in the Workspace. Additionally, the script assumes you want the model to appear and disappear for every player that joins the game. If you only want this functionality for one specific player, you can modify the script accordingly.
im making a roblox game, but when i do :fireson I want my model called fires to appear. and then when I do :firesoff my model will disappear. lua code
3 answers
im using kohls admin commands for roblox
If you are using Kohl's Admin Commands for Roblox, you can modify the script as follows:
```lua
local fires = game.Workspace:FindFirstChild("fires") -- Change "fires" to the name of your model
local function turnOnFires()
if fires then
fires.Parent = game.Workspace
end
end
local function turnOffFires()
if fires then
fires.Parent = nil
end
end
local adminCommands = require(game:GetService("ServerScriptService"):WaitForChild("AdminCommands")) -- Replace "AdminCommands" with the actual module name
adminCommands:addCommand("fireson", function(_, player)
turnOnFires()
end)
adminCommands:addCommand("firesoff", function(_, player)
turnOffFires()
end)
```
Make sure to replace "fires" in `local fires` with the actual name of your model in the Workspace. Additionally, ensure that you have the Kohl's Admin Commands module installed and replace "AdminCommands" in `require(game:GetService("ServerScriptService"):WaitForChild("AdminCommands"))` with the actual module name if necessary.
```lua
local fires = game.Workspace:FindFirstChild("fires") -- Change "fires" to the name of your model
local function turnOnFires()
if fires then
fires.Parent = game.Workspace
end
end
local function turnOffFires()
if fires then
fires.Parent = nil
end
end
local adminCommands = require(game:GetService("ServerScriptService"):WaitForChild("AdminCommands")) -- Replace "AdminCommands" with the actual module name
adminCommands:addCommand("fireson", function(_, player)
turnOnFires()
end)
adminCommands:addCommand("firesoff", function(_, player)
turnOffFires()
end)
```
Make sure to replace "fires" in `local fires` with the actual name of your model in the Workspace. Additionally, ensure that you have the Kohl's Admin Commands module installed and replace "AdminCommands" in `require(game:GetService("ServerScriptService"):WaitForChild("AdminCommands"))` with the actual module name if necessary.