You can write your topic however you want, but you need to answer these questions:
What do you want to achieve?
i want to send a command in chat if you arent touch a specific part then it localy sends a message back in chat that you arent touching a part, but if you are touching the part when the message has send then it would run my code
What is the issue?
i just dont know how to do it
What solutions have you tried so far?
i tryd using this but that didnt work:
local humanoid = otherpart.Parent:FindFirstChild("Humanoid")
if humanoid then
local playertouching = game.Players:FindFirstChild(otherpart.Parent.Name)
if playertouching then
player.Chatted:Connect(function(chat)
if string.find(chat,script.Name,1,9) then
warn("Message Send")
end
end)
end
end
end)
Okay so you want a script that when were someone used a chat command they have to be standing on a part for it to activate the function.
All items you’ll need:
debounce check
.Touched:Connect()
Player.Chatted:Connect()
These rest should be up to you
Example
Player.Chatted:Connect(function(msg)
Part.Touched:Connect(function(part)
local Debounce = false
local part = workspace.Part
local debounce = false
local filtercheck = nil -- the text you want them to type replace nil with it
game.Player.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if msg:match(filtertext) then -- you can change this to however you want
if debounce == true then
-- put your code here to be ran
debounce = false
else
-- put your code here to send a message
debounce = false
end
end
end)
Part.Touched:Connect(part)
if debounce == true then debounce = false end
if game.Players:GetPlayerFromCharacter(Part.Parent) == player then
debounce = true
end
end)
end)
-- just an example so don't use this and expect it to work fully
-- instead use this to come up with a script or hire a small developer to code it for you!