Just touching on this: you can only “concatenate an object” if you use tostring on it. Print calls tostring automatically across all its objects and if you run tostring(obj) .. "str", that’ll be successful. Objects have a tostring metamethod that returns their name.
Sometimes I don’t remember to tostring objects in print statements which is why I prefer to use arguments and let print handle that for me automatically. It’d probably be better to concatenate but I only use printing for surface debugging purposes.
print(player, "is not Premium") -- player is not Premium
Added benefit of a space automatically being added.
while true do
local player = game.Players.LocalPlayer
if player.MembershipType == Enum.MembershipType.Premium then
workspace["Zednov's Tycoon Kit"].GameEssentials.Multiplier.Value = 1.25
print(workspace["Zednov's Tycoon Kit"].GameEssentials.Multiplier.Value)
else
print(player..[[is not premium]])
end
wait(1) --please dont tell me about avoiding wait
end
Put it into StarterPlayerScripts.
If you want to know what's wrong with it
While in workspace, LocalScripts don’t run. They must be parented to ReplicatedFirst/Player or in any descendant of the player.
Abscence of waiting function causes script to run way too fast and it will error.
May I ask why are you using a LocalScript to give the player a cash multiplier? You should rather do it on the server in your cash handling script. That way you won’t have to worry about the parenting part, since I’m assuming you don’t have any problems running server scripts.
Also I’ve never tested it but I don’t think MembershipType can change mid game, so you can simply grab it on PlayerAdded in the server script instead of using a loop:
game.Players.PlayerAdded:Connect(function(plr)
if plr.MembershipType == Enum.MembershipType.Premium then
--give the player the coins multiplier
end
end)
Just gonna say before I say anything else: I am not the best scripter. I am just an experienced developer who wants to create a big game in the years to come. I started scripting less than 6 months ago.
There is part of your answer. Also, with a server script, changing the value of the multiplier changes the value for the ENTIRE SERVER. Now if you say, “That’s not always the case” then read what I said UP THERE.
And no, I sometimes do have problems with ALL kinds of scripts.
What’s the initial multiplier value? I think that even though we set the property from the local client, it retrieves data from the server, who still thinks that Multiplier value is the default.
And you don’t really need a pcall(). As far as I know, it’s used when working with services that rely on network (TeleportService, DataStoreService, etc.)
Eeek. I’m trying to get your script working, but I can’t because the player instance is now a userdata
But in theory, your code should work absolutely fine. I’ve done a little research, and it turns out that if you set an IntValue from the client that client will always see only that value and print() tells the local value.