#idk honestly
1 messages · Page 2 of 1
That is a solution
my game aint about dying anyway
yup
yo do you know how to send a server message if i get a rare roll or smth?
@lyric leaf
what exactly do you mean by a "Server message"
Like a message that every player sees?
Like a broadcast?
Or just a message that is sent to the Server so you know which player just got rare on the server
i mean like a chat message @lyric leaf
sry it took me a while
yes that every player sees
in the normal chat
i never figured that out
Aaa i see
I just looked into it and this would be an example for sending messages via code:
local TextChatService = game:GetService("TextChatService")
local function BroadcastMessage(message)
local channel = TextChatService:WaitForChild("TextChannels"):WaitForChild("RBXGeneral")
channel:DisplaySystemMessage(message)
end
BroadcastMessage("Yo")
Note tho: You can only use DisplaySystemMessage on the client
Depends tho what kind of chat system your using
or idk if they already got rid of all the old versions
Just try this code inside a local script and if it works then i think you can figure out the rest
@shy dust
ok
@lyric leaf numbervalue can store decimals like 0.1 while int just rounds it cuz it can store only full numbers right?
I think so
ok
i put local script into workspace and nothing
this guy is trying to help me make a game
just ignore this you wont help prob
i wont help with an entire game but simple things ya
ill ping you if i need help
i suggest new #1020374354867007528 threads, there's lots of scripters here but no one going to read a month old 1k response thread
Try this:
local TextChatService = game:GetService("TextChatService")
local function Message(message)
local channel = TextChatService:WaitForChild("TextChannels"):WaitForChild("RBXGeneral")
channel:DisplaySystemMessage(message)
end
task.wait(2)
Message("Yoooo")
And Pyro is right. Its better to make a new thread. Who knows maybe he would also help.
Can you help me with something?
i dont need help from anyone i got this guy lol
doesnt work either
how old is your game?
And can send me a screenshot of your TextChatService Properties?
or tell me if they are different from the screenshot i just send you
I'm not all knowing.
alr
huh. Seems fine. Maybe put the local script into StarterCharacterScripts? And if it still doesn't work show me the error message
localscripts dont run in workspace
yeah
that works @lyric leaf
if its in startercharcter
alr gud
probably better to put it in starterplayer
ik how
i think
yeah i know how to do this now
although i wish i could send the message for everyone
if that could somehow work
it does send for everyone
richtext
ai lua local TextChatService = game:GetService("TextChatService") local message = "You won <stroke color='#00A2FF' thickness='2'>25 gems</stroke>!" TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage(message)
@lyric leaf can you help?
ok
?
it is supposted to check which one is bigger
and the smaller one will get changed
like
the numbervalue
and since its changed
...
nwm
gimme a sec
ok
local rng = math.random(1,1000000000)
local secretrng = math.random(1,1000000000)
local leaderstats = Player:WaitForChild("leaderstats")
local RarityLeaderstat = leaderstats.HighestRarity
local RerollsLeaderstat = leaderstats.Rerolls
local RollUI = Player.PlayerGui.UI.RollUI
if secretrng < rng then
SecretValue.Value = secretrng
elseif secretrng == rng then
SecretValue.Value = secretrng
elseif secretrng > rng then
RollValue.Value = rng
else
print("Error Code: 2")
end
RerollsLeaderstat.Value = RerollsLeaderstat.Value + 1
RollValue.Changed:Connect(function()
if RollValue.Value < HighestValue.Value then
HighestValue.Value = RollValue.Value
end
end)
RollValue.Changed:Connect(function()
if RollValue.Value <= 0 then
print("Error")
elseif RollValue.Value <= 200000000 then
RollUI.UnCommon.Visible = true
UnlockIndex:FireClient(Player, "UnCommon")
if RarityLeaderstat.Value <= 5 then
RarityLeaderstat.Value = 5
end
elseif RollValue.Value <= 1000000000 then
RollUI.Common.Visible = true
UnlockIndex:FireClient(Player, "Common")
if RarityLeaderstat.Value <= 1 then
RarityLeaderstat.Value = 1
end
end
end)
SecretValue.Changed:Connect(function()
if SecretValue.Value <= 0 then
print("Error")
elseif SecretValue.Value <= 10000000 then
RollUI.Nothing.Visible = true
UnlockIndex:FireClient(Player, "Nothing")
if RarityLeaderstat.Value <= 100 then
RarityLeaderstat.Value = 0.01
end
end
end)
end)```
Ah i see
so line 2 and 3 generates 2 different numbers, rng and secretrng
wait
gotta fix ome thing
alr
local rng = math.random(1,1000000000)
local secretrng = math.random(1,1000000000)
local leaderstats = Player:WaitForChild("leaderstats")
local RarityLeaderstat = leaderstats.HighestRarity
local RerollsLeaderstat = leaderstats.Rerolls
local RollUI = Player.PlayerGui.UI.RollUI
if secretrng <= rng then
SecretValue.Value = secretrng
elseif secretrng > rng then
RollValue.Value = rng
else
print("Error Code: 2")
end
RerollsLeaderstat.Value = RerollsLeaderstat.Value + 1
RollValue.Changed:Connect(function()
if RollValue.Value < HighestValue.Value then
HighestValue.Value = RollValue.Value
end
end)
RollValue.Changed:Connect(function()
if RollValue.Value <= 0 then
print("Error")
elseif RollValue.Value <= 200000000 then
RollUI.UnCommon.Visible = true
UnlockIndex:FireClient(Player, "UnCommon")
if RarityLeaderstat.Value <= 5 then
RarityLeaderstat.Value = 5
end
elseif RollValue.Value <= 1000000000 then
RollUI.Common.Visible = true
UnlockIndex:FireClient(Player, "Common")
if RarityLeaderstat.Value <= 1 then
RarityLeaderstat.Value = 1
end
end
end)
SecretValue.Changed:Connect(function()
if SecretValue.Value <= 0 then
print("Error")
elseif SecretValue.Value <= 10000000 then
RollUI.Nothing.Visible = true
UnlockIndex:FireClient(Player, "Nothing")
if RarityLeaderstat.Value <= 100 then
RarityLeaderstat.Value = 0.01
end
end
end)
end)```
here
then it checks if secretrng is smaller than rng and if it is then it makes secretvalue secretrng
if rng is smaller than secretrng then it makes value of rollvalue rng
if rollvalue gets changed it does one function and if secretvalue gets changed then is does the other function
i tried making this myself
but pretty much
im trying to make it so it rolls twice and if one if smaller than the other then it uses only one of the functions
before i had it all in one function
where is did something based on one random number
but here it generates 2 numbers and based on which one is smaller it only uses one of the functions that does something based on the number that was smaller
i cant explain it better
now that i think abt it
im making this too complicated
So what is exactly the problem?
All i can see right now is the UI problem
But i feel like thats not what your point is
Im pretty sure that you cannot change UI elements on the server
That explains it
just make it so that that is on the client (RollUI.UnCommon.Visible = true)
that is weird
it sometimes does show up
well
cuz
local RollUI = Player.PlayerGui.UI.RollUI
when you roll it sends the player to this script
which means the script has the player meaning you can change client side things
Yeah but changing something on the server and changing something on the client can have completly different results.
such as UI
Nope. The server cannot change ANYTHING on the client. Thats why we have exploiters
It can only request the client to change something
wait what
The Client has complete control over its view. A client could basicly create its own gui and its own interface if it wants to
Thats also the reason why we need RemoteEvents. They are the only way to communicate with the client
which?
the one where you recive information from UnlockIndex
The one with the UnlockIndex RemoteEvent
local NonSecretsFrame = Player.PlayerGui.UI.Index.NonSecretsFrame
local PositiveSecretsFrame = Player.PlayerGui.UI.Index.PositiveSecretsFrame
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UnlockIndex = ReplicatedStorage.UnlockIndex
UnlockIndex.OnClientEvent:Connect(function(title)
if title == "Common" then
NonSecretsFrame.Common.Title.Text = "Common"
NonSecretsFrame.Common.EquipButton.EquipLabel.Enabled = true
elseif title == "Uncommon" then
NonSecretsFrame.Uncommon.Title.Text = "Uncommon"
NonSecretsFrame.Uncommon.EquipButton.EquipLabel.Enabled = true
elseif title == "Nothing" then
PositiveSecretsFrame.Nothing.Title.Text = "Nothing"
PositiveSecretsFrame.Nothing.EquipButton.EquipLabel.Enabled = true
end
end)```
i could open the ui using unlock index but
i cant
cuz i want the ui to open only during rolling
and i use unlockindex for example for loading data
so i cant use it there
But you do make the RollUI Visible right before firing the RemoteEvent. So why can't you just copy this line (RollUI.UnCommon.Visible = true) and place it inside your local script?
i just said i
t
cuz i use this unlock index to load data
when the player joins the game it uses unlockindex based on the stored data
but i want to make rollui visible only when rolling
i use unlockindex for other things
ig ill have to use another remote event
oh wiat
local Player = game.Players.LocalPlayer
local NonSecretsFrame = Player.PlayerGui.UI.Index.NonSecretsFrame
local PositiveSecretsFrame = Player.PlayerGui.UI.Index.PositiveSecretsFrame
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UnlockIndex = ReplicatedStorage.UnlockIndex
local RollUI = Player.PlayerGui.UI.RollUI
UnlockIndex.OnClientEvent:Connect(function(title)
if title == "Common" then
RollUI.Common.Visible = true
NonSecretsFrame.Common.Title.Text = "Common"
NonSecretsFrame.Common.EquipButton.EquipLabel.Enabled = true
elseif title == "Uncommon" then
RollUI.UnCommon.Visible = true
NonSecretsFrame.Uncommon.Title.Text = "Uncommon"
NonSecretsFrame.Uncommon.EquipButton.EquipLabel.Enabled = true
elseif title == "Nothing" then
PositiveSecretsFrame.Nothing.Title.Text = "Nothing"
PositiveSecretsFrame.Nothing.EquipButton.EquipLabel.Enabled = true
end
end)
Just liek this
it shouldn't interfer with your DataStores or anything at all. I just made it so that RollUI gets Enabled on the client
nothing more
i should explain
alr
yeah
when the leaderstats are loaded upon the player joining it unlocks the index that was saved as the rarest and i do not want it to also show rolling it when you join.
i just want it to unlock
ah i see. Just make a new argument
so if i use this it will show the roll even when you join
too late im already making another remoteevent
its not that long
ShowRoll.OnClientEvent:Connect(function(Title)
RollUI[Title].Visible = true
end)
whats this
the rollui[title]
?
does it like
pick whatever is the title
cuz yk i have folder of these uis
ai made that just now
[Title] pretty much is just a string if im not wrong so it should work i think. (Unless you give it a wrong title then it will error)
It just needs the exact name of the UI element now
oh
** You are now Level 14! **
actually ill do smth else now ill tell you in few hours
alr gl
uhh
local ShowRoll = ReplicatedStorage.ShowRoll
ShowRoll.OnClientEvent:Connect(function(Player, Title)
local RollUI = Player.PlayerGui.UI.RollUI
RollUI[Title].Visible = true
end)```
this is the remote event ive made
and i am pretty sure that if i replace RollUI.Common.Visible... with ShowRoll:FireClient(Player, "Common") i should fix it right?
@lyric leaf
?
@lyric leaf
Almost
The main idea is good but you did make a mistake when it comes to argumentes of RemotEvents
Instead of doing ```lua
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ShowRoll = ReplicatedStorage.ShowRoll
ShowRoll.OnClientEvent:Connect(function(Player, Title)
local RollUI = Player.PlayerGui.UI.RollUI
RollUI[Title].Visible = true
end)
You have to do
```lua
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ShowRoll = ReplicatedStorage.ShowRoll
local Player = game.Players.LocalPlayer
local RollUI = Player.PlayerGui.UI.RollUI
ShowRoll.OnClientEvent:Connect(function(Title)
RollUI[Title].Visible = true
end)
Always remember that the first Argument the Client recives from a RemoteEvent is not the Player
Yes. You only have to include the Player on the Server so the Game knows to which client it must sent the Information.
The First Argument of the function ShowRoll:FireClient(Player, "Common") is not getting passed to the client. Its only purpose is to let the game know to who it should send the information
And because the client always knows to which player it belongs it doesn't need to recive the player from a RemoteEvent that was fired on the server
so on the server i still have to do ShowRoll:FireClient(Player, Common) right?
yeah
but this would error
?
it doesnt always show up
only some times
the ui
when i click the buton
i also made so the button has cooldown
do you cant spam it
and possibly break the thing
local RollButton = script.Parent
local RollUI = Player.PlayerGui.UI.RollUI
local ReplicatedStorage = game:GetService("ReplicatedStorage")
RollButton.MouseButton1Click:Connect(function()
wait(0.1)
for _, v in next, RollUI:GetChildren() do
if v:IsA("Frame") then
v.Visible = false
end
end
ReplicatedStorage.Roll:FireServer(Player)
RollButton.Interactable = false
wait(0.5)
RollButton.Interactable = true
end)```
this is local script under button
idk if its right
every time you roll it will remove any visible rollui
wait
i might know
ofc
i just have to remove the wait(0.1)
its still broken
some times
hm.
Can you give me some video footage
wait
ill test if it even chooses anything
ohhh
i found out every time you roll secret rng it just doesnt show the roll
SecretValue.Value = secretrng
print("Rolled Secret Rng")
elseif secretrng > rng then
RollValue.Value = rng
print("Rolled Rng")
else
print("Error Code: 2")
end```
this is what i used
and every time it printed rolled secret rng the ui didnt show
did you fire the client?
huh
if SecretValue.Value <= 0 then
print("Error")
elseif SecretValue.Value <= 285714 then
ShowRoll:FireClient(Player, "Legacy")
UnlockIndex:FireClient(Player, "Legacy")
if RarityLeaderstat.Value <= 3500 then
RarityLeaderstat.Value = 0.35
end
elseif SecretValue.Value <= 769230 then
ShowRoll:FireClient(Player, "Positive")
UnlockIndex:FireClient(Player, "Positive")
if RarityLeaderstat.Value <= 1300 then
RarityLeaderstat.Value = 0.13
end
elseif SecretValue.Value <= 1111111 then
ShowRoll:FireClient(Player, "Effect")
UnlockIndex:FireClient(Player, "Effect")
if RarityLeaderstat.Value <= 900 then
RarityLeaderstat.Value = 0.09
end
elseif SecretValue.Value <= 10000000 then
ShowRoll:FireClient(Player, "Nothing")
UnlockIndex:FireClient(Player, "Nothing")
if RarityLeaderstat.Value <= 100 then
RarityLeaderstat.Value = 0.01
end
end
end)```
this is the whole secretrng thing
that detects what u rolled using only secretrng
RollUI[Title].Visible = true
print(Title)
end)```
this is what i just tested
it didnt print the title when i rolled secret rng
it only printed that i rolled secret rng
hm
didnt i make typo or smth
no then it would show you that
no but like logically
that i made something that makes sence but doesnt do what i want it
to do
i happens to me sometime
ill try printing when it rolls nothing for example
alr
** You are now Level 14! **
the rarity
yep it doesnt print
so the problem is that it cannot read what you rolled
liek the number
hm
i put print under elseif SecretValue.Value <= 10000000 then
and it didnt print
nope
nothing
printed
like
literally nothing
local rng = math.random(1,1000000000)
local secretrng = math.random(1,1000000000)
local leaderstats = Player:WaitForChild("leaderstats")
local RarityLeaderstat = leaderstats.HighestRarity
local RerollsLeaderstat = leaderstats.Rerolls
if secretrng <= rng then
SecretValue.Value = secretrng
print("Rolled Secret Rng")
elseif secretrng > rng then
RollValue.Value = rng
print("Rolled Rng")
else
print("Error Code: 2")
end```
this is the beginning of the script
if there is something wrong
so it prints Secret Rng but it doesn't print a rarity after that
yes
but it does print if the Event SecretValue.Changed is fired?
SecretValue.Changed:Connect(function()
print("SecretValue was Changed")
Try this
it does
print which number Secret Rng is
lets hope they respond
ill prin the value of SecretValue
yea
it prints normally
but like what did it print
the number
which was
374175519
i realized
why
omg im so dumb
cuz if the number is smaller than nothing's chance then it doesnt do anything
i gotta fix that
yuh
what does return do
alr let me make some examples so you can understand better
wait
but i want to do if the secret rng generates too big number it will return
and roll again
or idk
i might know
RollValue.Value = rng
elseif secretrng < rng then
SecretValue.Value = secretrng
elseif secretrng > rng then
RollValue.Value = rng
else
print("Error Code: 2")
end```
this?
1010101 and lower is the chance of nothing
Return basicly gives a function a value for example:
local function Addition(a, b)
local c = a + b
return c
end
local OnePlusOne = Addition(1, 1) -- (2)
Return also stops a function so for example.
local function Addition(a, b)
local c = a + b
if c then
return c
end
print("c was 0")
end
local OnePlusOne = Addition(1, 1) -- (2)
In this Example print("") was not executed
uh let me think
also why ur text colored?
i think so. I mean as long as SecretRng is smaller than the Nothing rarity
local ColoredText = "With lua after the ``"
local UncoloredText = "Without lua after the ``"
local DataStore = game:GetService("DataStoreService")
local LeaderboardDataStore = DataStore:GetDataStore("LeaderboardDataStore")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder", player)
leaderstats.Name = "leaderstats"
local Rarity = Instance.new("NumberValue", leaderstats)
Rarity.Name = "HighestRarity"
local Rerolls = Instance.new("NumberValue", leaderstats)
Rerolls.Name = "Rerolls"
local UserId = player.Name.." - "..player.UserId
local success, data = pcall(function()
return LeaderboardDataStore:GetAsync(UserId)
end)
if success and data then
Rarity.Value = data.Rarity or 0
Rerolls.Value = data.Rerolls or 0
else
Rarity.Value = 0
Rerolls.Value = 0
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local UserId = player.Name.." - "..player.UserId
local data = {
Rarity = player.leaderstats.HighestRarity.Value,
Rerolls = player.leaderstats.Rerolls.Value
}
local success, errormessage = pcall(function()
return LeaderboardDataStore:SetAsync(UserId, data)
end)
if not success then
warn("Failed to save data for "..player.Name.." - "..errormessage)
else
print("Successfully saved data for "..player.Name)
end
end)```
i literally use what you once gave me
yeah its datastore
@lyric leaf ?
there is an inbuild function for DataStores called DataStore:RemoveAsync()
or you could also go to roblox website and remove it there i think
hold up
Make anything you can imagine. Everything you need to start building on Roblox for free; join a global community of Creators and publish instantly to the world.
nvm i just gave you the datastore manager form my expierence mb
Make anything you can imagine. Everything you need to start building on Roblox for free; join a global community of Creators and publish instantly to the world.
here this should do it
then just click on your game
im in the data stores tab
i mean i have that data in studio
why is there 100mb storage limit
does that mean that some ppl wont event save their data?
I don't think your gonna be reaching that limit any time soon
and i think you can expand it later
neverminfd
so if i want to set default value of leaderstats to something can i just do
rarity.value = 0
under raraity.name...
Just change the 0 to the number you want
yeah
change the 0s
but only for the else
so these
because these values are the values that are set when there is no data found (Or the data could not be loaded)
is it really your first join?
well after i reset my data
then it should set the Rarity.Value to whatever is here
rolling a secret makes your rarityleaderstat a decimal for example nothing makes it 0.01 which it should but instead it turns to 1 which is weird cuz i made it so the leaderstat is a numbervalue which should support these numbers
@lyric leaf
here it clearly says that its a numbervalue
idk why it rounds up
i gtg but if you know solution just say it and ill read it later
I lowkey have no idea as well. For me it works just fine. Have you tried setting it Manually just to check?
yo i got a problem
Change.OnServerEvent:Connect(function(Player, Rarity)
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local Animator = Humanoid:FindFirstChildOfClass("Animator")
local StarstrikeAnimation = Instance.new("Animation")
StarstrikeAnimation.AnimationId = "rbxassetid://110028722881882"
local StarstrikeAnimationPlay = Animator:LoadAnimation(StarstrikeAnimation)
if Rarity == "Common" then
Equip:Fire(Player, "Common")
print("Common Equipped")
elseif Rarity == "Uncommon" then
Equip:Fire(Player, "UnCommon")
print("UnCommon Equipped")
elseif Rarity == "Rare" then
Equip:Fire(Player, "Rare")
print("Rare Equipped")
elseif Rarity == "Starstrike" then
Equip:Fire(Player, "Starstrike")
print("Starstrike Equipped")
StarstrikeAnimationPlay:Play()
end
end)```
everytime i equip starstrike the animation doesnt play
this is the part of the serverscript
the rarity equips but the animation doesnt play
idk why
@lyric leaf
Oh yeah you need to play that animation on the client.
Because Animations can't be played on the server for Parts with NetworkOwnerShip
So you either set the NetworkOwnerShip to nil (Which is not that good if its a player) or you just use a RemoteEvent
theres no way this is still going on
Well
Nvm i just rememberd, that NetworkOwnerShip can be sketchy. Just play animations on the client. Unless you really want to play them on the server for some reason. (Animations on the server feel less responsiv and are overall in my opinion worse than animations on the client)
1400+ responses be like:
maybe it's time to open a new thread, no one is reading all this
But if i play them on clie t nobody will see them
Lexcept the client
thats the funny part with animations
Everybody will see them. IF the client owns that part
That is also why exploiters can do these weird animations (If you have ever seen them on social media)
@lyric leaf
local Character = Player.Character
local Humanoid = Character.Humanoid
local Animator = Humanoid:FindFirstChildOfClass("Animator")
local VoidAnimation = Instance.new("Animation")
VoidAnimation.AnimationId = "rbxassetid://133397604937238"
local VoidTrack = Humanoid:LoadAnimation(VoidAnimation)
if Rarity == "Void" then
VoidTrack:Play()
end
end)```
idk why but it gives me error attempt to nil with humanoid
its a local script
local Player = game.Players.LocalPlayer
Animate.OnClientEvent:Connect(function(Rarity)
local Character = Player.Character
local Humanoid = Character.Humanoid
local Animator = Humanoid:FindFirstChildOfClass("Animator")
local VoidAnimation = Instance.new("Animation")
VoidAnimation.AnimationId = "rbxassetid://133397604937238"
local VoidTrack = Humanoid:LoadAnimation(VoidAnimation)
if Rarity == "Void" then
VoidTrack:Play()
end
end)
yo uhh can we work on the message system thing
this thing it doesnt work
You sure you want to use robloxes Inbuild text messages?
because idk if they will still display to everyone
i think they do
for what do you even want to use that
?
alr
@lyric leaf i have a problem
when i try to change leaderstat to a decimal like 0.01 it just makes it 1, i use number value to store the leaderstats how do i make it so it sets it to the actual number?
Idk. I normaly just make my own leaderstats system with my own gui
but how do i fix this bruhhh
@lyric leaf
yo
if i do if RarityLeaderstat.Value <= 100 and not 0.35 or 0.13 then does it do so it only does the function if the value is under 100 and is not 0.35 and 0.13 right?
@lyric leaf
if RarityLeaderstat.Value <= 100 and RarityLeaderstat.Value ~= 0.35 or RarityLeaderstat.Value ~= 0.13 then
~= means not for ==
oh
and you have to specify if you want
if (RarityLeaderstat.Value <= 100 and RarityLeaderstat.Value ~= 0.35) or RarityLeaderstat.Value ~= 0.13 then
or
if (RarityLeaderstat.Value <= 100 and RarityLeaderstat.Value ~= 0.35) or (RarityLeaderstat.Value <= 100 and RarityLeaderstat.Value ~= 0.13) then
```#
but i think you want the second option
@lyric leaf can i just dm you whenever ill have a problem i kinda hate it here
why
idk ppl are confused when they see 1k+ message post and 2 dudes just occasionally talking here
fair enough
but if you have a problem with that ig well stay in this post