So I probably could’ve made the title a bit less hard to comprehend, but I was wondering if there’s a way to make it so if a players in a game you can check if the id of the place is your id?
If this works, I’m only using it for business purposes like deals. If someone happened to steal my game for example, they would have to know how to script to actually remove checks for certain stuff.
function isYourPlace(YourUserId)
if game.CreatorType == Enum.CreatorType.User then
if game.CreatorId == YourUserId then
return true
else
return false
end
else
if game.CreatorType == Enum.CreatorType.Group then
local ownerId = game:GetService('GroupService'):GetGroupInfoAsync(game.CreatorId).Owner.Id
if ownerId == YourUserId then
return true
else
return false
end
end
end
end
Ok so,
In your script have the script I sent and then after it do isYourPlace(409522146)
The script will then return true or false
if true. then the place is owned by you.
if false. then it is not owned by you.
Here is an example:
function isYourPlace(YourUserId)
if game.CreatorType == Enum.CreatorType.User then
if game.CreatorId == YourUserId then
return true
else
return false
end
else
if game.CreatorType == Enum.CreatorType.Group then
local ownerId = game:GetService('GroupService'):GetGroupInfoAsync(game.CreatorId).Owner.Id
if ownerId == YourUserId then
return true
else
return false
end
end
end
end
if isYourPlace(409522146) then
print("You own this place!!")
else
print("You dont own this place.")
end
That’s not what I meant what I’m trying to say is you never really described what each part of your script does, so it’s confusing to understand. I’m seeing things I usually don’t tamper with, and I don’t know what you’re doing.
So, I’ll try to explain how this script works for the OP.
Enomphia has created a function which you can call that will check if the given UserId is the owner of the place. So if you give your UserId to the function, the function will return true if the game is owned by you, and false if you don’t (so someone stole your game).
The first two lines check whether game’s CreatorId is equal to that of the given UserId. Theoretically this given UserId should be your UserId. (The first if-statement is there because the game might be owned by a group – so the CreatorId won’t be accurate. This case is handled in the second half of the function, where it gets the group’s owner’s UserId and compares it your UserId the same way as before.)
In essence, though, the function is just a longer version of this:
if game.CreatorId ~= <your UserId here> then
print("Oh no, the game is stolen!")
end